mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-27 12:29:50 +01:00
feat(lyrics): expose source provenance
Signed-off-by: ranokay <github@ranokay.com>
This commit is contained in:
parent
5fafda1544
commit
e90d94ff06
15 changed files with 271 additions and 47 deletions
9
plugins/testdata/test-lyrics/main.go
vendored
9
plugins/testdata/test-lyrics/main.go
vendored
|
|
@ -20,6 +20,13 @@ func (t *testLyrics) GetLyrics(input lyrics.GetLyricsRequest) (lyrics.GetLyricsR
|
|||
return lyrics.GetLyricsResponse{}, fmt.Errorf("%s", errMsg)
|
||||
}
|
||||
|
||||
var source *lyrics.LyricsSource
|
||||
provider, hasProvider := pdk.GetConfig("source_provider")
|
||||
sourceFormat, hasSourceFormat := pdk.GetConfig("source_format")
|
||||
if hasProvider || hasSourceFormat {
|
||||
source = &lyrics.LyricsSource{Provider: provider, Format: sourceFormat}
|
||||
}
|
||||
|
||||
// Config-selected format lets tests exercise the adapter's content-sniffing per format.
|
||||
format, hasFormat := pdk.GetConfig("format")
|
||||
if hasFormat {
|
||||
|
|
@ -52,6 +59,7 @@ func (t *testLyrics) GetLyrics(input lyrics.GetLyricsRequest) (lyrics.GetLyricsR
|
|||
if text != "" {
|
||||
return lyrics.GetLyricsResponse{
|
||||
Lyrics: []lyrics.LyricsText{{Lang: lang, Text: text}},
|
||||
Source: source,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
|
@ -65,6 +73,7 @@ func (t *testLyrics) GetLyrics(input lyrics.GetLyricsRequest) (lyrics.GetLyricsR
|
|||
|
||||
// Return test lyrics based on track info
|
||||
return lyrics.GetLyricsResponse{
|
||||
Source: source,
|
||||
Lyrics: []lyrics.LyricsText{
|
||||
{
|
||||
Lang: lang,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue