diff --git a/src/renderer/api/jellyfin/jellyfin-controller.ts b/src/renderer/api/jellyfin/jellyfin-controller.ts index 6460b6787..900d7665e 100644 --- a/src/renderer/api/jellyfin/jellyfin-controller.ts +++ b/src/renderer/api/jellyfin/jellyfin-controller.ts @@ -409,6 +409,8 @@ export const JellyfinController: InternalControllerEndpoint = { return jfNormalize.album( { ...res.body, Songs: songsRes.body.Items }, apiClientProps.server, + args.context?.pathReplace, + args.context?.pathReplaceWith, ); }, getAlbumList: async (args) => { @@ -580,7 +582,8 @@ export const JellyfinController: InternalControllerEndpoint = { return `${apiClientProps.server?.url}/items/${query.id}/download?apiKey=${apiClientProps.server?.credential}`; }, - getFolder: async ({ apiClientProps, query }) => { + getFolder: async (args) => { + const { apiClientProps, query } = args; const userId = apiClientProps.server?.userId; if (!userId) throw new Error('No userId found'); @@ -742,6 +745,8 @@ export const JellyfinController: InternalControllerEndpoint = { jfNormalize.song( item as unknown as z.infer, apiClientProps.server, + args.context?.pathReplace, + args.context?.pathReplaceWith, ), ); diff --git a/src/renderer/api/navidrome/navidrome-controller.ts b/src/renderer/api/navidrome/navidrome-controller.ts index 21d98e2bc..9d8888b2c 100644 --- a/src/renderer/api/navidrome/navidrome-controller.ts +++ b/src/renderer/api/navidrome/navidrome-controller.ts @@ -496,7 +496,12 @@ export const NavidromeController: InternalControllerEndpoint = { } return res.body.similarSongs.song.map((song) => - ssNormalize.song(song, apiClientProps.server), + ssNormalize.song( + song, + apiClientProps.server, + args.context?.pathReplace, + args.context?.pathReplaceWith, + ), ); }, getArtistList: async (args) => { @@ -566,7 +571,12 @@ export const NavidromeController: InternalControllerEndpoint = { } return res.body.similarSongs2.song.map((song) => - ssNormalize.song(song, apiClientProps.server), + ssNormalize.song( + song, + apiClientProps.server, + args.context?.pathReplace, + args.context?.pathReplaceWith, + ), ); }, getDownloadUrl: SubsonicController.getDownloadUrl, @@ -823,7 +833,14 @@ export const NavidromeController: InternalControllerEndpoint = { return ( (res.body.similarSongs?.song || []) .filter((song) => song.id !== query.songId) - .map((song) => ssNormalize.song(song, apiClientProps.server)) || [] + .map((song) => + ssNormalize.song( + song, + apiClientProps.server, + args.context?.pathReplace, + args.context?.pathReplaceWith, + ), + ) || [] ); }, getSongDetail: async (args) => { @@ -1022,6 +1039,7 @@ export const NavidromeController: InternalControllerEndpoint = { const res = await NavidromeController.getSongList({ apiClientProps, + context: args.context, query: { artistIds: [query.artistId], sortBy: SongListSort.PLAY_COUNT, diff --git a/src/renderer/api/subsonic/subsonic-controller.ts b/src/renderer/api/subsonic/subsonic-controller.ts index 4b1cd373d..3aead3db9 100644 --- a/src/renderer/api/subsonic/subsonic-controller.ts +++ b/src/renderer/api/subsonic/subsonic-controller.ts @@ -2125,6 +2125,7 @@ export const SubsonicController: InternalControllerEndpoint = { const res = await SubsonicController.getSongList({ apiClientProps, + context, query: { artistIds: [query.artistId], sortBy: SongListSort.PLAY_COUNT, diff --git a/src/shared/api/jellyfin/jellyfin-normalize.ts b/src/shared/api/jellyfin/jellyfin-normalize.ts index 59d72c921..69152c3a1 100644 --- a/src/shared/api/jellyfin/jellyfin-normalize.ts +++ b/src/shared/api/jellyfin/jellyfin-normalize.ts @@ -278,6 +278,8 @@ const normalizeSong = ( const normalizeAlbum = ( item: z.infer, server: null | ServerListItem, + pathReplace?: string, + pathReplaceWith?: string, ): Album => { const { originalYear, releaseDate, releaseYear } = jellyfinPremiereFields(item); @@ -340,7 +342,7 @@ const normalizeAlbum = ( releaseYear, size: null, songCount: item?.ChildCount || null, - songs: item.Songs?.map((song) => normalizeSong(song, server)), + songs: item.Songs?.map((song) => normalizeSong(song, server, pathReplace, pathReplaceWith)), sortName: item.SortName || item.Name, tags: getTags(item), updatedAt: item?.DateLastMediaAdded || item.DateCreated,