mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
omit song from similar list, handle subsonic error
This commit is contained in:
parent
f81bea339b
commit
3a116e938e
4 changed files with 24 additions and 8 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue