fix missing path replacement transformations

This commit is contained in:
jeffvli
2026-04-16 00:29:13 -07:00
parent 382d279dad
commit cc4e933c07
4 changed files with 31 additions and 5 deletions
@@ -409,6 +409,8 @@ export const JellyfinController: InternalControllerEndpoint = {
return jfNormalize.album( return jfNormalize.album(
{ ...res.body, Songs: songsRes.body.Items }, { ...res.body, Songs: songsRes.body.Items },
apiClientProps.server, apiClientProps.server,
args.context?.pathReplace,
args.context?.pathReplaceWith,
); );
}, },
getAlbumList: async (args) => { getAlbumList: async (args) => {
@@ -580,7 +582,8 @@ export const JellyfinController: InternalControllerEndpoint = {
return `${apiClientProps.server?.url}/items/${query.id}/download?apiKey=${apiClientProps.server?.credential}`; 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; const userId = apiClientProps.server?.userId;
if (!userId) throw new Error('No userId found'); if (!userId) throw new Error('No userId found');
@@ -742,6 +745,8 @@ export const JellyfinController: InternalControllerEndpoint = {
jfNormalize.song( jfNormalize.song(
item as unknown as z.infer<typeof jfType._response.song>, item as unknown as z.infer<typeof jfType._response.song>,
apiClientProps.server, apiClientProps.server,
args.context?.pathReplace,
args.context?.pathReplaceWith,
), ),
); );
@@ -496,7 +496,12 @@ export const NavidromeController: InternalControllerEndpoint = {
} }
return res.body.similarSongs.song.map((song) => 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) => { getArtistList: async (args) => {
@@ -566,7 +571,12 @@ export const NavidromeController: InternalControllerEndpoint = {
} }
return res.body.similarSongs2.song.map((song) => 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, getDownloadUrl: SubsonicController.getDownloadUrl,
@@ -823,7 +833,14 @@ export const NavidromeController: InternalControllerEndpoint = {
return ( return (
(res.body.similarSongs?.song || []) (res.body.similarSongs?.song || [])
.filter((song) => song.id !== query.songId) .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) => { getSongDetail: async (args) => {
@@ -1022,6 +1039,7 @@ export const NavidromeController: InternalControllerEndpoint = {
const res = await NavidromeController.getSongList({ const res = await NavidromeController.getSongList({
apiClientProps, apiClientProps,
context: args.context,
query: { query: {
artistIds: [query.artistId], artistIds: [query.artistId],
sortBy: SongListSort.PLAY_COUNT, sortBy: SongListSort.PLAY_COUNT,
@@ -2125,6 +2125,7 @@ export const SubsonicController: InternalControllerEndpoint = {
const res = await SubsonicController.getSongList({ const res = await SubsonicController.getSongList({
apiClientProps, apiClientProps,
context,
query: { query: {
artistIds: [query.artistId], artistIds: [query.artistId],
sortBy: SongListSort.PLAY_COUNT, sortBy: SongListSort.PLAY_COUNT,
@@ -278,6 +278,8 @@ const normalizeSong = (
const normalizeAlbum = ( const normalizeAlbum = (
item: z.infer<typeof jfType._response.album>, item: z.infer<typeof jfType._response.album>,
server: null | ServerListItem, server: null | ServerListItem,
pathReplace?: string,
pathReplaceWith?: string,
): Album => { ): Album => {
const { originalYear, releaseDate, releaseYear } = jellyfinPremiereFields(item); const { originalYear, releaseDate, releaseYear } = jellyfinPremiereFields(item);
@@ -340,7 +342,7 @@ const normalizeAlbum = (
releaseYear, releaseYear,
size: null, size: null,
songCount: item?.ChildCount || 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, sortName: item.SortName || item.Name,
tags: getTags(item), tags: getTags(item),
updatedAt: item?.DateLastMediaAdded || item.DateCreated, updatedAt: item?.DateLastMediaAdded || item.DateCreated,