Browse Source

Fix album and song normalizers

master
jeffvli 3 years ago
committed by Jeff
parent
commit
c14cc83ada
  1. 10
      src/api/jellyfinApi.ts

10
src/api/jellyfinApi.ts

@ -95,13 +95,13 @@ const normalizeSong = (item: any) => {
year: item.ProductionYear, year: item.ProductionYear,
genre: item.GenreItems && item.GenreItems.map((entry: any) => normalizeItem(entry)), genre: item.GenreItems && item.GenreItems.map((entry: any) => normalizeItem(entry)),
albumGenre: item.GenreItems && item.GenreItems[0]?.Name, albumGenre: item.GenreItems && item.GenreItems[0]?.Name,
size: item.MediaSources && item.MediaSources.Size, size: item.MediaSources && item.MediaSources[0]?.Size,
contentType: undefined, contentType: undefined,
suffix: undefined, suffix: item.MediaSources && item.MediaSources[0]?.Container,
duration: item.RunTimeTicks / 10000000, duration: item.RunTimeTicks / 10000000,
bitRate: item.MediaSources && item.MediaSources.MediaStreams?.BitRate, bitRate: item.MediaSources && String(Math.trunc(item.MediaSources[0]?.Bitrate / 1000)),
path: item.Path, path: item.Path,
playCount: item.UserData.PlayCount, playCount: item.UserData && item.UserData.PlayCount,
discNumber: undefined, discNumber: undefined,
created: item.DateCreated, created: item.DateCreated,
streamUrl: getStreamUrl(item.Id), streamUrl: getStreamUrl(item.Id),
@ -127,7 +127,7 @@ const normalizeAlbum = (item: any) => {
genre: item.GenreItems && item.GenreItems.map((entry: any) => normalizeItem(entry)), genre: item.GenreItems && item.GenreItems.map((entry: any) => normalizeItem(entry)),
image: getCoverArtUrl(item, 350), image: getCoverArtUrl(item, 350),
isDir: false, isDir: false,
starred: item.UserData.IsFavorite ? 'true' : undefined, starred: item.UserData && item.UserData.IsFavorite ? 'true' : undefined,
type: Item.Album, type: Item.Album,
uniqueId: nanoid(), uniqueId: nanoid(),
song: (item.song || []).map((entry: any) => normalizeSong(entry)), song: (item.song || []).map((entry: any) => normalizeSong(entry)),

Loading…
Cancel
Save