add missed files in previous commit

This commit is contained in:
Drew Weymouth
2024-06-01 11:20:13 -07:00
parent 0c004baadd
commit 77d21717f6
2 changed files with 23 additions and 0 deletions
+4
View File
@@ -267,6 +267,10 @@ type LyricsProvider interface {
GetLyrics(track *Track) (*Lyrics, error)
}
type RadioProvider interface {
GetRadioStations() ([]*RadioStation, error)
}
type JukeboxProvider interface {
JukeboxStart() error
JukeboxStop() error
@@ -386,6 +386,7 @@ func (s *subsonicMediaProvider) GetLyrics(track *mediaprovider.Track) (*mediapro
}
// CanSavePlayQueue interface
var _ mediaprovider.CanSavePlayQueue = (*subsonicMediaProvider)(nil)
func (s *subsonicMediaProvider) SavePlayQueue(trackIDs []string, currentTrackIdx int, timeSeconds int) error {
if len(trackIDs) == 0 {
@@ -413,6 +414,24 @@ func (s *subsonicMediaProvider) GetPlayQueue() (*mediaprovider.SavedPlayQueue, e
return savedQueue, nil
}
// RadioProvider interface
var _ mediaprovider.RadioProvider = (*subsonicMediaProvider)(nil)
func (s *subsonicMediaProvider) GetRadioStations() ([]*mediaprovider.RadioStation, error) {
rs, err := s.client.GetInternetRadioStations()
if err != nil {
return nil, err
}
return sharedutil.MapSlice(rs, func(rs *subsonic.InternetRadioStation) *mediaprovider.RadioStation {
return &mediaprovider.RadioStation{
ID: "radio-" + strings.ReplaceAll(rs.Name, " ", ""),
Name: rs.Name,
HomePageURL: rs.HomePageUrl,
StreamURL: rs.StreamUrl,
}
}), nil
}
func toTrack(ch *subsonic.Child) *mediaprovider.Track {
if ch == nil {
return nil