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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user