Fix various api types
This commit is contained in:
parent
888bab50c9
commit
bcfb9dbec3
4 changed files with 13 additions and 11 deletions
|
@ -642,6 +642,7 @@ const normalizeSong = (
|
||||||
bitRate: item.MediaSources && Number(Math.trunc(item.MediaSources[0]?.Bitrate / 1000)),
|
bitRate: item.MediaSources && Number(Math.trunc(item.MediaSources[0]?.Bitrate / 1000)),
|
||||||
bpm: null,
|
bpm: null,
|
||||||
channels: null,
|
channels: null,
|
||||||
|
comment: null,
|
||||||
compilation: null,
|
compilation: null,
|
||||||
container: (item.MediaSources && item.MediaSources[0]?.Container) || null,
|
container: (item.MediaSources && item.MediaSources[0]?.Container) || null,
|
||||||
createdAt: item.DateCreated,
|
createdAt: item.DateCreated,
|
||||||
|
@ -654,7 +655,6 @@ const normalizeSong = (
|
||||||
isFavorite: (item.UserData && item.UserData.IsFavorite) || false,
|
isFavorite: (item.UserData && item.UserData.IsFavorite) || false,
|
||||||
lastPlayedAt: null,
|
lastPlayedAt: null,
|
||||||
name: item.Name,
|
name: item.Name,
|
||||||
note: null,
|
|
||||||
path: (item.MediaSources && item.MediaSources[0]?.Path) || null,
|
path: (item.MediaSources && item.MediaSources[0]?.Path) || null,
|
||||||
playCount: (item.UserData && item.UserData.PlayCount) || 0,
|
playCount: (item.UserData && item.UserData.PlayCount) || 0,
|
||||||
// releaseDate: (item.ProductionYear && new Date(item.ProductionYear, 0, 1).toISOString()) || null,
|
// releaseDate: (item.ProductionYear && new Date(item.ProductionYear, 0, 1).toISOString()) || null,
|
||||||
|
|
|
@ -516,6 +516,7 @@ const normalizeSong = (
|
||||||
bitRate: item.bitRate,
|
bitRate: item.bitRate,
|
||||||
bpm: item.bpm ? item.bpm : null,
|
bpm: item.bpm ? item.bpm : null,
|
||||||
channels: item.channels ? item.channels : null,
|
channels: item.channels ? item.channels : null,
|
||||||
|
comment: item.comment ? item.comment : null,
|
||||||
compilation: item.compilation,
|
compilation: item.compilation,
|
||||||
container: item.suffix,
|
container: item.suffix,
|
||||||
createdAt: item.createdAt.split('T')[0],
|
createdAt: item.createdAt.split('T')[0],
|
||||||
|
@ -526,9 +527,8 @@ const normalizeSong = (
|
||||||
imagePlaceholderUrl,
|
imagePlaceholderUrl,
|
||||||
imageUrl,
|
imageUrl,
|
||||||
isFavorite: item.starred,
|
isFavorite: item.starred,
|
||||||
lastPlayedAt: item.playDate ? item.playDate : null,
|
lastPlayedAt: item.playDate.includes('0001-') ? null : item.playDate,
|
||||||
name: item.title,
|
name: item.title,
|
||||||
note: item.comment ? item.comment : null,
|
|
||||||
path: item.path,
|
path: item.path,
|
||||||
playCount: item.playCount,
|
playCount: item.playCount,
|
||||||
releaseDate: new Date(item.year, 0, 1).toISOString(),
|
releaseDate: new Date(item.year, 0, 1).toISOString(),
|
||||||
|
@ -567,7 +567,7 @@ const normalizeAlbum = (item: NDAlbum, server: ServerListItem, imageSize?: numbe
|
||||||
imageUrl,
|
imageUrl,
|
||||||
isCompilation: item.compilation,
|
isCompilation: item.compilation,
|
||||||
isFavorite: item.starred,
|
isFavorite: item.starred,
|
||||||
lastPlayedAt: item.playDate ? item.playDate.split('T')[0] : null,
|
lastPlayedAt: item.playDate.includes('0001-') ? null : item.playDate,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
playCount: item.playCount,
|
playCount: item.playCount,
|
||||||
rating: item.rating,
|
rating: item.rating,
|
||||||
|
@ -583,16 +583,18 @@ const normalizeAlbum = (item: NDAlbum, server: ServerListItem, imageSize?: numbe
|
||||||
};
|
};
|
||||||
|
|
||||||
const normalizeAlbumArtist = (item: NDAlbumArtist): AlbumArtist => {
|
const normalizeAlbumArtist = (item: NDAlbumArtist): AlbumArtist => {
|
||||||
|
console.log('item :>> ', item);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
albumCount: item.albumCount,
|
albumCount: item.albumCount,
|
||||||
backgroundImageUrl: null,
|
backgroundImageUrl: null,
|
||||||
biography: item.biography,
|
biography: item.biography || null,
|
||||||
duration: null,
|
duration: null,
|
||||||
genres: item.genres,
|
genres: item.genres,
|
||||||
id: item.id,
|
id: item.id,
|
||||||
imageUrl: item.largeImageUrl,
|
imageUrl: item.largeImageUrl || null,
|
||||||
isFavorite: item.starred,
|
isFavorite: item.starred,
|
||||||
lastPlayedAt: item.playDate ? item.playDate.split('T')[0] : null,
|
lastPlayedAt: item.playDate.includes('0001-') ? null : item.playDate,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
playCount: item.playCount,
|
playCount: item.playCount,
|
||||||
rating: item.rating,
|
rating: item.rating,
|
||||||
|
|
|
@ -113,16 +113,16 @@ export type NDAlbumArtist = {
|
||||||
fullText: string;
|
fullText: string;
|
||||||
genres: NDGenre[];
|
genres: NDGenre[];
|
||||||
id: string;
|
id: string;
|
||||||
largeImageUrl: string;
|
largeImageUrl?: string;
|
||||||
mbzArtistId: string;
|
mbzArtistId: string;
|
||||||
mediumImageUrl: string;
|
mediumImageUrl?: string;
|
||||||
name: string;
|
name: string;
|
||||||
orderArtistName: string;
|
orderArtistName: string;
|
||||||
playCount: number;
|
playCount: number;
|
||||||
playDate: string;
|
playDate: string;
|
||||||
rating: number;
|
rating: number;
|
||||||
size: number;
|
size: number;
|
||||||
smallImageUrl: string;
|
smallImageUrl?: string;
|
||||||
songCount: number;
|
songCount: number;
|
||||||
starred: boolean;
|
starred: boolean;
|
||||||
starredAt: string;
|
starredAt: string;
|
||||||
|
|
|
@ -179,6 +179,7 @@ export type Song = {
|
||||||
bitRate: number;
|
bitRate: number;
|
||||||
bpm: number | null;
|
bpm: number | null;
|
||||||
channels: number | null;
|
channels: number | null;
|
||||||
|
comment: string | null;
|
||||||
compilation: boolean | null;
|
compilation: boolean | null;
|
||||||
container: string | null;
|
container: string | null;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
|
@ -191,7 +192,6 @@ export type Song = {
|
||||||
isFavorite: boolean;
|
isFavorite: boolean;
|
||||||
lastPlayedAt: string | null;
|
lastPlayedAt: string | null;
|
||||||
name: string;
|
name: string;
|
||||||
note: string | null;
|
|
||||||
path: string | null;
|
path: string | null;
|
||||||
playCount: number;
|
playCount: number;
|
||||||
releaseDate: string | null;
|
releaseDate: string | null;
|
||||||
|
|
Reference in a new issue