@christianriedl/media 1.0.147 → 1.0.149

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,15 +9,15 @@ export class MediaService {
9
9
  log;
10
10
  user;
11
11
  mainRoot = {
12
- Name: "Root", DLNAID: "0", ItemType: EItemType.MainRoot,
13
- State: EState.FolderReal, ChildCount: 4, Folders: [], Files: [], Rating: 63, CreatorIdx: -1, GenreIdx: -1,
14
- Year: -1, Description: "", DLNAParentID: "", Url: "", ThumbnailUrl: "", Date: new Date()
12
+ name: "Root", dlnaid: "0", itemType: EItemType.MainRoot,
13
+ state: EState.FolderReal, childCount: 4, folders: [], files: [], rating: 63, creatorIdx: -1, genreIdx: -1,
14
+ year: -1, description: "", dlnaParentId: "", url: "", thumbnailUrl: "", date: new Date()
15
15
  };
16
16
  roots = {};
17
17
  folders = {};
18
18
  realPictureAlbums = {};
19
19
  medialists = {};
20
- pictureLocation = { Name: "", Values: [] };
20
+ pictureLocation = { name: "", values: [] };
21
21
  listsInitialized = 0;
22
22
  lastFolderId = "";
23
23
  realFolderId = "";
@@ -33,7 +33,7 @@ export class MediaService {
33
33
  rating: 1,
34
34
  criteria: 'ye',
35
35
  root: 'Jahr',
36
- selected: { Name: 'Root', ItemType: EItemType.Root }
36
+ selected: { name: 'Root', itemType: EItemType.Root }
37
37
  };
38
38
  constructor(rest, user, statistics, pictureParentLimit, log) {
39
39
  this.log = log;
@@ -48,15 +48,15 @@ export class MediaService {
48
48
  this.mediaUrl = rest.serviceUrl;
49
49
  }
50
50
  prepareFolders(folder) {
51
- this.folders[folder.DLNAID] = folder;
52
- folder.ChildCount = Number(folder.ChildCount);
53
- folder.ItemType = Number(folder.ItemType);
54
- folder.title = folder.Name;
55
- folder.State = Number(folder.State);
56
- folder.Year = Number(folder.Year);
57
- folder.title = folder.Name;
51
+ this.folders[folder.dlnaid] = folder;
52
+ folder.childCount = Number(folder.childCount);
53
+ folder.itemType = Number(folder.itemType);
54
+ folder.title = folder.name;
55
+ folder.state = Number(folder.state);
56
+ folder.year = Number(folder.year);
57
+ folder.title = folder.name;
58
58
  folder.subTitle = '';
59
- switch (folder.ItemType) {
59
+ switch (folder.itemType) {
60
60
  case EItemType.PictureRoot:
61
61
  case EItemType.PictureFolder:
62
62
  case EItemType.PictureRating:
@@ -65,24 +65,24 @@ export class MediaService {
65
65
  case EItemType.PictureYear:
66
66
  case EItemType.PictureAlbum:
67
67
  if (folder.mustExpand)
68
- folder.info = folder.Name;
68
+ folder.info = folder.name;
69
69
  else
70
- folder.info = `${folder.Name} (${folder.ChildCount})`;
70
+ folder.info = `${folder.name} (${folder.childCount})`;
71
71
  break;
72
72
  case EItemType.AudioAlbum:
73
- folder.subTitle = this.folders[folder.DLNAParentID].Name;
74
- folder.ThumbnailUrl = this.getAlbumArtUrl(folder.ThumbnailUrl);
73
+ folder.subTitle = this.folders[folder.dlnaParentId].name;
74
+ folder.thumbnailUrl = this.getAlbumArtUrl(folder.thumbnailUrl);
75
75
  break;
76
76
  case EItemType.VideoGenreType:
77
- folder.Folders = [];
77
+ folder.folders = [];
78
78
  return false; // Remove it
79
79
  }
80
- if (folder.Folders) {
81
- for (var i = 0; i < folder.Folders.length;)
82
- if (this.prepareFolders(folder.Folders[i]))
80
+ if (folder.folders) {
81
+ for (var i = 0; i < folder.folders.length;)
82
+ if (this.prepareFolders(folder.folders[i]))
83
83
  i++;
84
84
  else
85
- folder.Folders.splice(i, 1); // remove
85
+ folder.folders.splice(i, 1); // remove
86
86
  }
87
87
  return true;
88
88
  }
@@ -175,22 +175,22 @@ export class MediaService {
175
175
  this.prepareFolders(root);
176
176
  this.roots['online'] = root;
177
177
  const videos = this.folders['online.rectv'];
178
- this.log.trace(`getRecordedTVs ${videos.Files.length}`);
179
- videos.ChildCount = Number(videos.ChildCount);
180
- videos.ItemType = Number(videos.ItemType);
181
- videos.State = Number(videos.State);
182
- videos.title = videos.Name;
183
- videos.subTitle = this.folders[videos.DLNAParentID].Name;
184
- videos.ThumbnailUrl = "";
185
- for (var i = 0; i < videos.Files.length; i++) {
186
- const video = videos.Files[i];
187
- video.ItemType = Number(video.ItemType);
188
- video.State = Number(video.State);
189
- video.Duration = Number(video.Duration);
190
- video.title = video.Name;
191
- video.info = MediaHelper.durationString(video.Duration);
192
- video.ThumbnailUrl = "";
193
- video.subTitle = video.Description;
178
+ this.log.trace(`getRecordedTVs ${videos.files.length}`);
179
+ videos.childCount = Number(videos.childCount);
180
+ videos.itemType = Number(videos.itemType);
181
+ videos.state = Number(videos.state);
182
+ videos.title = videos.name;
183
+ videos.subTitle = this.folders[videos.dlnaParentId].name;
184
+ videos.thumbnailUrl = "";
185
+ for (var i = 0; i < videos.files.length; i++) {
186
+ const video = videos.files[i];
187
+ video.itemType = Number(video.itemType);
188
+ video.state = Number(video.state);
189
+ video.duration = Number(video.duration);
190
+ video.title = video.name;
191
+ video.info = MediaHelper.durationString(video.duration);
192
+ video.thumbnailUrl = "";
193
+ video.subTitle = video.description;
194
194
  }
195
195
  return videos;
196
196
  }
@@ -200,26 +200,26 @@ export class MediaService {
200
200
  this.prepareFolders(root);
201
201
  this.roots['online'] = root;
202
202
  const videos = this.folders['online.tv'];
203
- this.log.trace(`getTVs ${videos.Files.length}`);
204
- videos.ChildCount = Number(videos.ChildCount);
205
- videos.ItemType = Number(videos.ItemType);
206
- videos.State = Number(videos.State);
207
- videos.title = videos.Name;
208
- videos.subTitle = this.folders[videos.DLNAParentID].Name;
209
- for (var i = 0; i < videos.Files.length; i++) {
210
- const video = videos.Files[i];
211
- video.ItemType = Number(video.ItemType);
212
- video.State = Number(video.State);
213
- video.Duration = Number(video.Duration);
214
- video.title = video.Name;
215
- video.info = MediaHelper.durationString(video.Duration);
216
- if (videos.Url && video.Url)
217
- video.Url = videos.Url + video.Url;
218
- if (videos.ThumbnailUrl && video.ThumbnailUrl)
219
- video.ThumbnailUrl = videos.ThumbnailUrl + video.ThumbnailUrl;
220
- video.subTitle = video.Description;
203
+ this.log.trace(`getTVs ${videos.files.length}`);
204
+ videos.childCount = Number(videos.childCount);
205
+ videos.itemType = Number(videos.itemType);
206
+ videos.state = Number(videos.state);
207
+ videos.title = videos.name;
208
+ videos.subTitle = this.folders[videos.dlnaParentId].name;
209
+ for (var i = 0; i < videos.files.length; i++) {
210
+ const video = videos.files[i];
211
+ video.itemType = Number(video.itemType);
212
+ video.state = Number(video.state);
213
+ video.duration = Number(video.duration);
214
+ video.title = video.name;
215
+ video.info = MediaHelper.durationString(video.duration);
216
+ if (videos.url && video.url)
217
+ video.url = videos.url + video.url;
218
+ if (videos.thumbnailUrl && video.thumbnailUrl)
219
+ video.thumbnailUrl = videos.thumbnailUrl + video.thumbnailUrl;
220
+ video.subTitle = video.description;
221
221
  }
222
- videos.ThumbnailUrl = "";
222
+ videos.thumbnailUrl = "";
223
223
  return videos;
224
224
  }
225
225
  async getOnlineRadios() {
@@ -228,45 +228,45 @@ export class MediaService {
228
228
  this.prepareFolders(root);
229
229
  this.roots['online'] = root;
230
230
  const audios = this.folders['online.radio'];
231
- this.log.trace(`getRadios ${audios.Files.length}`);
232
- audios.ChildCount = Number(audios.ChildCount);
233
- audios.ItemType = Number(audios.ItemType);
234
- audios.State = Number(audios.State);
235
- audios.title = audios.Name;
236
- audios.subTitle = this.folders[audios.DLNAParentID].Name;
237
- for (var i = 0; i < audios.Files.length; i++) {
238
- const audio = audios.Files[i];
239
- audio.ItemType = Number(audio.ItemType);
240
- audio.State = Number(audio.State);
241
- audio.Duration = Number(audio.Duration);
242
- audio.title = audio.Name;
243
- audio.info = MediaHelper.durationString(audio.Duration);
244
- audio.subTitle = audio.Description;
245
- if (audios.ThumbnailUrl && audio.ThumbnailUrl)
246
- audio.ThumbnailUrl = audios.ThumbnailUrl + audio.ThumbnailUrl;
247
- audio.Url = audios.Url + audio.Url;
231
+ this.log.trace(`getRadios ${audios.files.length}`);
232
+ audios.childCount = Number(audios.childCount);
233
+ audios.itemType = Number(audios.itemType);
234
+ audios.state = Number(audios.state);
235
+ audios.title = audios.name;
236
+ audios.subTitle = this.folders[audios.dlnaParentId].name;
237
+ for (var i = 0; i < audios.files.length; i++) {
238
+ const audio = audios.files[i];
239
+ audio.itemType = Number(audio.itemType);
240
+ audio.state = Number(audio.state);
241
+ audio.duration = Number(audio.duration);
242
+ audio.title = audio.name;
243
+ audio.info = MediaHelper.durationString(audio.duration);
244
+ audio.subTitle = audio.description;
245
+ if (audios.thumbnailUrl && audio.thumbnailUrl)
246
+ audio.thumbnailUrl = audios.thumbnailUrl + audio.thumbnailUrl;
247
+ audio.url = audios.url + audio.url;
248
248
  }
249
- audios.ThumbnailUrl = "";
249
+ audios.thumbnailUrl = "";
250
250
  return audios;
251
251
  }
252
252
  getListEntry(name, idx) {
253
253
  var list = this.medialists[name];
254
- if (list && idx < list.Values.length)
255
- return list.Values[idx];
254
+ if (list && idx < list.values.length)
255
+ return list.values[idx];
256
256
  return `${name}.${idx}`;
257
257
  }
258
258
  async getPhotos(folder) {
259
259
  let realPhotos;
260
- const newFolder = this.lastFolderId !== folder.DLNAID;
261
- this.lastFolderId = folder.DLNAID;
262
- if (folder.State & EState.FolderVirtual) {
260
+ const newFolder = this.lastFolderId !== folder.dlnaid;
261
+ this.lastFolderId = folder.dlnaid;
262
+ if (folder.state & EState.FolderVirtual) {
263
263
  if (newFolder) {
264
- const refs = await this.browseReferences(folder.DLNAID);
264
+ const refs = await this.browseReferences(folder.dlnaid);
265
265
  this.referenceDict.clear();
266
266
  for (var i = 0; i < refs.Files.length; i++) {
267
267
  this.referenceDict.add(refs.Files[i]);
268
268
  }
269
- this.realFolderId = folder.DLNAID;
269
+ this.realFolderId = folder.dlnaid;
270
270
  var idx = this.realFolderId.indexOf('|');
271
271
  this.realFolderId = 'ph.all.ye' + this.realFolderId.substr(idx);
272
272
  this.log.trace(`getPhotos virtual ${refs.Files.length} ${this.realFolderId}`);
@@ -274,140 +274,140 @@ export class MediaService {
274
274
  realPhotos = this.realPictureAlbums[this.realFolderId];
275
275
  if (!realPhotos) {
276
276
  realPhotos = await this.browse(this.realFolderId, 1, false, false);
277
- this.log.trace(`getPhotos virtual getReal ${realPhotos.Files.length}`);
277
+ this.log.trace(`getPhotos virtual getReal ${realPhotos.files.length}`);
278
278
  this.processPhotos(realPhotos);
279
279
  this.removePrivate(realPhotos);
280
280
  this.realPictureAlbums[this.realFolderId] = realPhotos;
281
281
  }
282
- folder.Url = realPhotos.Url;
282
+ folder.url = realPhotos.url;
283
283
  var virtualPhotos = {
284
- ItemType: folder.ItemType,
285
- State: folder.State,
286
- Name: folder.Name,
287
- Description: folder.Description,
288
- ChildCount: 0,
289
- DLNAID: folder.DLNAID,
290
- DLNAParentID: folder.DLNAParentID,
291
- Rating: folder.Rating,
292
- Url: realPhotos.Url,
293
- ThumbnailUrl: folder.ThumbnailUrl,
294
- Year: folder.Year,
295
- Folders: [],
296
- Files: [],
297
- GenreIdx: folder.GenreIdx,
298
- CreatorIdx: folder.CreatorIdx,
299
- Date: folder.Date,
284
+ itemType: folder.itemType,
285
+ state: folder.state,
286
+ name: folder.name,
287
+ description: folder.description,
288
+ childCount: 0,
289
+ dlnaid: folder.dlnaid,
290
+ dlnaParentId: folder.dlnaParentId,
291
+ rating: folder.rating,
292
+ url: realPhotos.url,
293
+ thumbnailUrl: folder.thumbnailUrl,
294
+ year: folder.year,
295
+ folders: [],
296
+ files: [],
297
+ genreIdx: folder.genreIdx,
298
+ creatorIdx: folder.creatorIdx,
299
+ date: folder.date,
300
300
  };
301
- for (var i = 0; i < realPhotos.Files.length; i++) {
302
- if (this.referenceDict.has(realPhotos.Files[i].DLNAID)) {
303
- const photo = realPhotos.Files[i];
301
+ for (var i = 0; i < realPhotos.files.length; i++) {
302
+ if (this.referenceDict.has(realPhotos.files[i].dlnaid)) {
303
+ const photo = realPhotos.files[i];
304
304
  if (newFolder)
305
305
  photo.selected = false;
306
- virtualPhotos.Files.push(photo);
307
- virtualPhotos.ChildCount++;
306
+ virtualPhotos.files.push(photo);
307
+ virtualPhotos.childCount++;
308
308
  }
309
309
  }
310
- this.log.trace(`getPhotos virtual get ${virtualPhotos.Files.length}`);
311
- folder.ChildCount = virtualPhotos.ChildCount;
310
+ this.log.trace(`getPhotos virtual get ${virtualPhotos.files.length}`);
311
+ folder.childCount = virtualPhotos.childCount;
312
312
  return virtualPhotos;
313
313
  }
314
- realPhotos = this.realPictureAlbums[folder.DLNAID];
314
+ realPhotos = this.realPictureAlbums[folder.dlnaid];
315
315
  if (!realPhotos) {
316
- realPhotos = await this.browse(folder.DLNAID, 1, false, false);
317
- this.realPictureAlbums[folder.DLNAID] = realPhotos;
316
+ realPhotos = await this.browse(folder.dlnaid, 1, false, false);
317
+ this.realPictureAlbums[folder.dlnaid] = realPhotos;
318
318
  this.processPhotos(realPhotos);
319
319
  this.removePrivate(realPhotos);
320
- this.log.trace(`getPhotos real get ${realPhotos.Files.length}`);
320
+ this.log.trace(`getPhotos real get ${realPhotos.files.length}`);
321
321
  }
322
322
  if (newFolder) {
323
- for (var i = 0; i < realPhotos.Files.length; i++)
324
- realPhotos.Files[i].selected = false;
323
+ for (var i = 0; i < realPhotos.files.length; i++)
324
+ realPhotos.files[i].selected = false;
325
325
  }
326
- folder.ChildCount = realPhotos.ChildCount;
326
+ folder.childCount = realPhotos.childCount;
327
327
  return realPhotos;
328
328
  }
329
329
  processPhotos(folder) {
330
- if (folder.Files) {
331
- for (var i = 0; i < folder.Files.length; i++) {
332
- const photo = folder.Files[i];
333
- if (photo.Orientation && typeof photo.Orientation === 'string')
334
- photo.Orientation = Number(photo.Orientation);
335
- if (photo.Date) {
336
- if (typeof photo.Date === 'string') {
337
- const date = new Date(Number(photo.Year), 0, 1).getTime() + Number(photo.Date) * 1000;
338
- photo.Date = new Date(date);
330
+ if (folder.files) {
331
+ for (var i = 0; i < folder.files.length; i++) {
332
+ const photo = folder.files[i];
333
+ if (photo.orientation && typeof photo.orientation === 'string')
334
+ photo.orientation = Number(photo.orientation);
335
+ if (photo.date) {
336
+ if (typeof photo.date === 'string') {
337
+ const date = new Date(Number(photo.year), 0, 1).getTime() + Number(photo.date) * 1000;
338
+ photo.date = new Date(date);
339
339
  }
340
- else if (typeof photo.Date === 'number')
341
- photo.Date = Helper.fromMilliseconds1970(photo.Date * 1000);
340
+ else if (typeof photo.date === 'number')
341
+ photo.date = Helper.fromMilliseconds1970(photo.date * 1000);
342
342
  }
343
343
  photo.title = MediaHelper.getPhotoDisplayName(folder, photo, this.pictureLocation, folder);
344
344
  }
345
345
  }
346
346
  }
347
347
  removePrivate(folder) {
348
- if (this.privateIdx >= 0 && folder.Files) {
349
- for (var i = 0; i < folder.Files.length;) {
350
- if (folder.Files[i].CreatorIdx == this.privateIdx)
351
- folder.Files.splice(i, 1);
348
+ if (this.privateIdx >= 0 && folder.files) {
349
+ for (var i = 0; i < folder.files.length;) {
350
+ if (folder.files[i].creatorIdx == this.privateIdx)
351
+ folder.files.splice(i, 1);
352
352
  else
353
353
  i++;
354
354
  }
355
- folder.ChildCount = folder.Files.length;
355
+ folder.childCount = folder.files.length;
356
356
  }
357
357
  }
358
358
  async getAudios(folder) {
359
- const audios = await this.browse(folder.DLNAID, 1, false, false);
360
- this.log.trace(`getAudios ${audios.Files.length}`);
361
- audios.ChildCount = Number(audios.ChildCount);
362
- audios.ItemType = Number(audios.ItemType);
363
- audios.State = Number(audios.State);
364
- audios.title = audios.Name;
365
- audios.subTitle = this.folders[audios.DLNAParentID].Name;
366
- audios.ThumbnailUrl = folder.ThumbnailUrl;
367
- for (var i = 0; i < audios.Files.length; i++) {
368
- const audio = audios.Files[i];
369
- audio.ItemType = Number(audio.ItemType);
370
- audio.State = Number(audio.State);
371
- audio.Duration = Number(audio.Duration);
372
- audio.title = `${audio.TrackNo} ${audio.Name}`;
373
- audio.subTitle = MediaHelper.durationString(audio.Duration);
374
- audio.ThumbnailUrl = "";
359
+ const audios = await this.browse(folder.dlnaid, 1, false, false);
360
+ this.log.trace(`getAudios ${audios.files.length}`);
361
+ audios.childCount = Number(audios.childCount);
362
+ audios.itemType = Number(audios.itemType);
363
+ audios.state = Number(audios.state);
364
+ audios.title = audios.name;
365
+ audios.subTitle = this.folders[audios.dlnaParentId].name;
366
+ audios.thumbnailUrl = folder.thumbnailUrl;
367
+ for (var i = 0; i < audios.files.length; i++) {
368
+ const audio = audios.files[i];
369
+ audio.itemType = Number(audio.itemType);
370
+ audio.state = Number(audio.state);
371
+ audio.duration = Number(audio.duration);
372
+ audio.title = `${audio.trackNo} ${audio.name}`;
373
+ audio.subTitle = MediaHelper.durationString(audio.duration);
374
+ audio.thumbnailUrl = "";
375
375
  }
376
376
  return audios;
377
377
  }
378
378
  async getVideos(folder) {
379
- const videos = await this.browse(folder.DLNAID, 1, false, false);
380
- this.log.trace(`getVideos ${videos.Files.length}`);
381
- videos.ChildCount = Number(videos.ChildCount);
382
- videos.ItemType = Number(videos.ItemType);
383
- videos.State = Number(videos.State);
384
- videos.title = videos.Name;
385
- videos.subTitle = this.folders[videos.DLNAParentID].Name;
386
- videos.ThumbnailUrl = folder.ThumbnailUrl;
387
- for (var i = 0; i < videos.Files.length; i++) {
388
- const video = videos.Files[i];
389
- video.ItemType = Number(video.ItemType);
390
- video.State = Number(video.State);
391
- video.Duration = Number(video.Duration);
392
- if (typeof video.CountryIdx === 'string')
393
- video.CountryIdx = Number(video.CountryIdx);
394
- if (typeof video.CreatorIdx === 'string')
395
- video.CreatorIdx = Number(video.CreatorIdx);
396
- if (typeof video.GenreIdx === 'string')
397
- video.GenreIdx = Number(video.GenreIdx);
398
- video.title = video.Name;
399
- video.info = MediaHelper.durationString(video.Duration);
400
- video.ThumbnailUrl = this.getAlbumArtUrl(video.ThumbnailUrl);
379
+ const videos = await this.browse(folder.dlnaid, 1, false, false);
380
+ this.log.trace(`getVideos ${videos.files.length}`);
381
+ videos.childCount = Number(videos.childCount);
382
+ videos.itemType = Number(videos.itemType);
383
+ videos.state = Number(videos.state);
384
+ videos.title = videos.name;
385
+ videos.subTitle = this.folders[videos.dlnaParentId].name;
386
+ videos.thumbnailUrl = folder.thumbnailUrl;
387
+ for (var i = 0; i < videos.files.length; i++) {
388
+ const video = videos.files[i];
389
+ video.itemType = Number(video.itemType);
390
+ video.state = Number(video.state);
391
+ video.duration = Number(video.duration);
392
+ if (typeof video.countryIdx === 'string')
393
+ video.countryIdx = Number(video.countryIdx);
394
+ if (typeof video.creatorIdx === 'string')
395
+ video.creatorIdx = Number(video.creatorIdx);
396
+ if (typeof video.genreIdx === 'string')
397
+ video.genreIdx = Number(video.genreIdx);
398
+ video.title = video.name;
399
+ video.info = MediaHelper.durationString(video.duration);
400
+ video.thumbnailUrl = this.getAlbumArtUrl(video.thumbnailUrl);
401
401
  video.subTitle = "";
402
- if (video.Year)
403
- video.subTitle = video.Year.toString();
404
- if (video.CountryIdx && video.CountryIdx >= 0) {
405
- const country = this.getListEntry('Video.Countries', video.CountryIdx);
402
+ if (video.year)
403
+ video.subTitle = video.year.toString();
404
+ if (video.countryIdx && video.countryIdx >= 0) {
405
+ const country = this.getListEntry('Video.Countries', video.countryIdx);
406
406
  if (country)
407
407
  video.subTitle += ' - ' + country;
408
408
  }
409
- if (video.CreatorIdx && video.CreatorIdx >= 0) {
410
- const reg = this.getListEntry('Video.Director', video.CreatorIdx);
409
+ if (video.creatorIdx && video.creatorIdx >= 0) {
410
+ const reg = this.getListEntry('Video.Director', video.creatorIdx);
411
411
  if (reg)
412
412
  video.subTitle += ' - ' + reg;
413
413
  }
@@ -422,8 +422,8 @@ export class MediaService {
422
422
  return MediaHelper.getPhotoDisplayName(folder, picture, this.pictureLocation, album);
423
423
  }
424
424
  getAudioUrl(item) {
425
- const album = this.folders[item.DLNAParentID];
426
- const audiourl = `${this.mediaUrl}apistream/Audio${album.Url}${item.Url}`;
425
+ const album = this.folders[item.dlnaParentId];
426
+ const audiourl = `${this.mediaUrl}apistream/Audio${album.url}${item.url}`;
427
427
  return encodeURI(audiourl);
428
428
  }
429
429
  getVideoUrl(url) {
@@ -441,8 +441,8 @@ export class MediaService {
441
441
  return encodeURI(downloadurl);
442
442
  }
443
443
  getPhotosDownloadUrl(folder, resy, quality, photoIds) {
444
- var name = folder.Name.replaceAll(' ', '_');
445
- var downloadurl = `${this.mediaUrl}apimedia/PhotosZipped/${name}?id=${folder.DLNAID}`;
444
+ var name = folder.name.replaceAll(' ', '_');
445
+ var downloadurl = `${this.mediaUrl}apimedia/PhotosZipped/${name}?id=${folder.dlnaid}`;
446
446
  if (resy)
447
447
  downloadurl += `&resy=${resy}`;
448
448
  if (quality)
@@ -486,13 +486,13 @@ export class MediaService {
486
486
  return "";
487
487
  }
488
488
  buildStatistics(folder) {
489
- if (folder.Folders) {
490
- this.statistics.increment(this.countFolders, folder.Folders.length);
491
- for (let i = 0; i < folder.Folders.length; i++)
492
- this.buildStatistics(folder.Folders[i]);
489
+ if (folder.folders) {
490
+ this.statistics.increment(this.countFolders, folder.folders.length);
491
+ for (let i = 0; i < folder.folders.length; i++)
492
+ this.buildStatistics(folder.folders[i]);
493
493
  }
494
- if (folder.Files)
495
- this.statistics.increment(this.countFiles, folder.Files.length);
494
+ if (folder.files)
495
+ this.statistics.increment(this.countFiles, folder.files.length);
496
496
  }
497
497
  async browseReferences(id) {
498
498
  const ref = await this.rest.getData('apimedia/browse', { id: id, depth: 1, onlyFolder: false, onlyReal: false });
@@ -530,23 +530,23 @@ export class MediaService {
530
530
  async getLists(mediaType) {
531
531
  const res = await this.rest.getData('apimedia/medialist', { mediaType: mediaType });
532
532
  const list = res.result;
533
- this.initializeLists(mediaType, list.Lists, list.PrivateCreatorIdx);
534
- this.log.trace(`getLists get ${list.Lists.length}`);
533
+ this.initializeLists(mediaType, list.lists, list.privateCreatorIdx);
534
+ this.log.trace(`getLists get ${list.lists.length}`);
535
535
  return true;
536
536
  }
537
537
  initializeLists(mediaType, entries, privateCreator) {
538
538
  for (var i = 0; i < entries.length; i++) {
539
539
  const li = entries[i];
540
- if (li.Values)
541
- this.statistics.increment(this.countList, li.Values.length);
540
+ if (li.values)
541
+ this.statistics.increment(this.countList, li.values.length);
542
542
  if (mediaType == EMediaType.Picture) {
543
543
  // Handle private creator
544
- if (li.Name == 'Picture.Creator') {
544
+ if (li.name == 'Picture.Creator') {
545
545
  if (this.user != 'ric@rts.co.at' && this.user != 'rih@rts.co.at') {
546
546
  this.privateIdx = privateCreator;
547
547
  if (!this.privateIdx) {
548
- for (var j = 0; j < li.Values.length; j++) {
549
- if (li.Values[j] === "Christian Riedl Privat") {
548
+ for (var j = 0; j < li.values.length; j++) {
549
+ if (li.values[j] === "Christian Riedl Privat") {
550
550
  this.privateIdx = j;
551
551
  break;
552
552
  }
@@ -554,22 +554,22 @@ export class MediaService {
554
554
  }
555
555
  }
556
556
  }
557
- if (li.Name == 'Picture.Location') {
557
+ if (li.name == 'Picture.Location') {
558
558
  this.pictureLocation = li;
559
- li.Children = [];
560
- for (let i = 0; i < li.Parents.length; i++) {
561
- li.Children.push([]);
559
+ li.children = [];
560
+ for (let i = 0; i < li.parents.length; i++) {
561
+ li.children.push([]);
562
562
  }
563
- for (let i = 0; i < li.Parents.length; i++) {
564
- const parentIdx = li.Parents[i];
563
+ for (let i = 0; i < li.parents.length; i++) {
564
+ const parentIdx = li.parents[i];
565
565
  if (parentIdx >= 0) {
566
- const childArray = li.Children[parentIdx];
566
+ const childArray = li.children[parentIdx];
567
567
  childArray.push(i);
568
568
  }
569
569
  }
570
570
  }
571
571
  }
572
- this.medialists[li.Name] = li;
572
+ this.medialists[li.name] = li;
573
573
  }
574
574
  this.listsInitialized |= (1 << mediaType);
575
575
  }
@@ -629,7 +629,7 @@ export class MediaService {
629
629
  return [];
630
630
  }
631
631
  getFileUrl(path) {
632
- return this.rest.serviceUrl + 'apimedia/documents/file?path=' + encodeURI(path);
632
+ return this.rest.serviceUrl + 'apimedia/document/' + encodeURI(path);
633
633
  }
634
634
  get audioRoot() {
635
635
  return this.roots['mu'];