mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
omit song from similar list, handle subsonic error
This commit is contained in:
@@ -460,9 +460,17 @@ const getSimilarSongs = async (args: SimilarSongsArgs): Promise<Song[]> => {
|
||||
throw new Error('Failed to get similar songs');
|
||||
}
|
||||
|
||||
return res.body.similarSongs.song.map((song) =>
|
||||
ssNormalize.song(song, apiClientProps.server, ''),
|
||||
);
|
||||
if (!res.body.similarSongs) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return res.body.similarSongs.song.reduce<Song[]>((acc, song) => {
|
||||
if (song.id !== query.songId) {
|
||||
acc.push(ssNormalize.song(song, apiClientProps.server, ''));
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
};
|
||||
|
||||
export const ssController = {
|
||||
|
||||
@@ -253,9 +253,11 @@ const similarSongsParameters = z.object({
|
||||
});
|
||||
|
||||
const similarSongs = z.object({
|
||||
similarSongs: z.object({
|
||||
song: z.array(song),
|
||||
}),
|
||||
similarSongs: z
|
||||
.object({
|
||||
song: z.array(song),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export const ssType = {
|
||||
|
||||
Reference in New Issue
Block a user