[enhancement]: better version checks for lyrics, Navidrome (#529)

- Actually make serverfeatures partial
- Navidrome: only set multiple structured lyrics if extension exists
- Navidrome/Subsonic: minor type checking of OS extension (Navidrome implementation detail)
- Jellyfin: add separate knob for lyrics. Note, this should also probably be behind some version check...
This commit is contained in:
Kendall Garner 2024-03-05 08:31:51 +00:00 committed by GitHub
parent d52d9136b8
commit 73845a9432
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 34 additions and 34 deletions

View file

@ -96,7 +96,18 @@ export const useSongLyricsBySong = (
if (!server) throw new Error('Server not found');
if (!song) return null;
if (server.type === ServerType.JELLYFIN) {
if (hasFeature(server, ServerFeature.MULTIPLE_STRUCTURED_LYRICS)) {
const subsonicLyrics = await api.controller
.getStructuredLyrics({
apiClientProps: { server, signal },
query: { songId: song.id },
})
.catch(console.error);
if (subsonicLyrics) {
return subsonicLyrics;
}
} else if (hasFeature(server, ServerFeature.SINGLE_STRUCTURED_LYRIC)) {
const jfLyrics = await api.controller
.getLyrics({
apiClientProps: { server, signal },
@ -113,17 +124,6 @@ export const useSongLyricsBySong = (
source: server?.name ?? 'music server',
};
}
} else if (hasFeature(server, ServerFeature.SONG_LYRICS)) {
const subsonicLyrics = await api.controller
.getStructuredLyrics({
apiClientProps: { server, signal },
query: { songId: song.id },
})
.catch(console.error);
if (subsonicLyrics) {
return subsonicLyrics;
}
} else if (song.lyrics) {
return {
artist: song.artists?.[0]?.name,