feat: Add Song radio option in tracklist.

At this moment this feature is only available on the Subsonic media provider. Using a
Jellyfin server the "Play song radio" option will be disabled.
This commit is contained in:
natilou
2024-03-30 12:26:42 -03:00
parent b7e7e959ff
commit 298f4f6602
13 changed files with 88 additions and 1 deletions
+4
View File
@@ -200,6 +200,10 @@ type SupportsSharing interface {
CanShareArtists() bool
}
type SupportsSongRadio interface {
GetSongRadio(trackID string, count int) ([]*Track, error)
}
type LyricsProvider interface {
GetLyrics(track *Track) (*Lyrics, error)
}
@@ -543,3 +543,11 @@ func fillPlaylist(pl *subsonic.Playlist, playlist *mediaprovider.Playlist) {
playlist.TrackCount = pl.SongCount
playlist.Duration = pl.Duration
}
func (s *subsonicMediaProvider) GetSongRadio(trackID string, count int) ([]*mediaprovider.Track, error) {
tr, err := s.client.GetSimilarSongs(trackID, map[string]string{"count": strconv.Itoa(count)})
if err != nil {
return nil, err
}
return sharedutil.MapSlice(tr, toTrack), nil
}