diff --git a/src/renderer/api/jellyfin.api.ts b/src/renderer/api/jellyfin.api.ts index 9cce8d61..f7c9b95a 100644 --- a/src/renderer/api/jellyfin.api.ts +++ b/src/renderer/api/jellyfin.api.ts @@ -572,6 +572,8 @@ const normalizeSong = ( artistName: item.ArtistItems[0]?.Name, artists: item.ArtistItems.map((entry) => ({ id: entry.Id, name: entry.Name })), bitRate: item.MediaSources && Number(Math.trunc(item.MediaSources[0]?.Bitrate / 1000)), + bpm: null, + channels: null, compilation: null, container: (item.MediaSources && item.MediaSources[0]?.Container) || null, createdAt: item.DateCreated, @@ -581,10 +583,13 @@ const normalizeSong = ( id: item.Id, imageUrl: getSongCoverArtUrl({ baseUrl: server.url, item, size: imageSize || 300 }), isFavorite: (item.UserData && item.UserData.IsFavorite) || false, + lastPlayedAt: null, name: item.Name, + note: null, path: (item.MediaSources && item.MediaSources[0]?.Path) || null, 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, + releaseDate: null, releaseYear: (item.ProductionYear && String(item.ProductionYear)) || null, serverId: server.id, size: item.MediaSources && item.MediaSources[0]?.Size, diff --git a/src/renderer/api/navidrome.api.ts b/src/renderer/api/navidrome.api.ts index d7315456..ac3811ac 100644 --- a/src/renderer/api/navidrome.api.ts +++ b/src/renderer/api/navidrome.api.ts @@ -455,6 +455,8 @@ const normalizeSong = ( artistName: item.artist, artists: [{ id: item.artistId, name: item.artist }], bitRate: item.bitRate, + bpm: item.bpm ? item.bpm : null, + channels: item.channels ? item.channels : null, compilation: item.compilation, container: item.suffix, createdAt: item.createdAt.split('T')[0], @@ -464,7 +466,9 @@ const normalizeSong = ( id: item.id, imageUrl, isFavorite: item.starred, + lastPlayedAt: item.playDate ? item.playDate : null, name: item.title, + note: item.comment ? item.comment : null, path: item.path, playCount: item.playCount, releaseDate: new Date(item.year, 0, 1).toISOString(), diff --git a/src/renderer/api/navidrome.types.ts b/src/renderer/api/navidrome.types.ts index f2abfde0..e254c557 100644 --- a/src/renderer/api/navidrome.types.ts +++ b/src/renderer/api/navidrome.types.ts @@ -56,7 +56,9 @@ export type NDSong = { artistId: string; bitRate: number; bookmarkPosition: number; - channels: number; + bpm?: number; + channels?: number; + comment?: string; compilation: boolean; createdAt: string; discNumber: number; @@ -66,6 +68,7 @@ export type NDSong = { genres: NDGenre[]; hasCoverArt: boolean; id: string; + lyrics?: string; mbzAlbumArtistId: string; mbzAlbumId: string; mbzArtistId: string; @@ -206,7 +209,7 @@ export type NDAlbumListParams = { NDOrder; export enum NDSongListSort { - ALBUM = 'album', + ALBUM = 'album, order_album_artist_name, disc_number, track_number, title', ALBUM_ARTIST = 'albumArtist', ARTIST = 'artist', BPM = 'bpm', diff --git a/src/renderer/api/types.ts b/src/renderer/api/types.ts index 3caee781..90b89975 100644 --- a/src/renderer/api/types.ts +++ b/src/renderer/api/types.ts @@ -174,6 +174,8 @@ export type Song = { artistName: string; artists: RelatedArtist[]; bitRate: number; + bpm: number | null; + channels: number | null; compilation: boolean | null; container: string | null; createdAt: string; @@ -183,7 +185,9 @@ export type Song = { id: string; imageUrl: string | null; isFavorite: boolean; + lastPlayedAt: string | null; name: string; + note: string | null; path: string | null; playCount: number; releaseDate: string | null; @@ -393,6 +397,7 @@ export type RawSongListResponse = NDSongList | JFSongList | undefined; export type SongListResponse = BasePaginatedResponse; export enum SongListSort { + ALBUM = 'album', ALBUM_ARTIST = 'albumArtist', ARTIST = 'artist', BPM = 'bpm', @@ -416,6 +421,8 @@ export type SongListQuery = { filters?: string; genres?: string; includeItemTypes: 'Audio'; + maxYear?: number; + minYear?: number; sortBy?: JFSongListSort; years?: string; }; @@ -430,6 +437,7 @@ export type SongListQuery = { title?: string; year?: number; }; + searchTerm?: string; sortBy: SongListSort; sortOrder: SortOrder; startIndex: number; @@ -445,6 +453,7 @@ type SongListSortMap = { export const songListSortMap: SongListSortMap = { jellyfin: { + album: JFSongListSort.ALBUM, albumArtist: JFSongListSort.ALBUM_ARTIST, artist: JFSongListSort.ARTIST, bpm: undefined, @@ -463,6 +472,7 @@ export const songListSortMap: SongListSortMap = { year: undefined, }, navidrome: { + album: NDSongListSort.ALBUM, albumArtist: NDSongListSort.ALBUM_ARTIST, artist: NDSongListSort.ARTIST, bpm: NDSongListSort.BPM, @@ -481,6 +491,7 @@ export const songListSortMap: SongListSortMap = { year: NDSongListSort.YEAR, }, subsonic: { + album: undefined, albumArtist: undefined, artist: undefined, bpm: undefined,