don't crash on exit when saving play queue with nothing playing
This commit is contained in:
@@ -381,14 +381,16 @@ func (s *subsonicMediaProvider) GetLyrics(track *mediaprovider.Track) (*mediapro
|
|||||||
|
|
||||||
// CanSavePlayQueue interface
|
// CanSavePlayQueue interface
|
||||||
|
|
||||||
func (s *subsonicMediaProvider) SavePlayQueue(trackIDs []string, currentTrackPos int, timeSeconds int) error {
|
func (s *subsonicMediaProvider) SavePlayQueue(trackIDs []string, currentTrackIdx int, timeSeconds int) error {
|
||||||
if len(trackIDs) == 0 {
|
if len(trackIDs) == 0 {
|
||||||
return nil // don't save an empty queue
|
return nil // don't save an empty queue
|
||||||
}
|
}
|
||||||
return s.client.SavePlayQueue(trackIDs, map[string]string{
|
params := make(map[string]string)
|
||||||
"current": trackIDs[currentTrackPos],
|
if currentTrackIdx >= 0 {
|
||||||
"position": strconv.Itoa(timeSeconds * 1000),
|
params["position"] = strconv.Itoa(timeSeconds * 1000)
|
||||||
})
|
params["current"] = trackIDs[currentTrackIdx]
|
||||||
|
}
|
||||||
|
return s.client.SavePlayQueue(trackIDs, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *subsonicMediaProvider) GetPlayQueue() (*mediaprovider.SavedPlayQueue, error) {
|
func (s *subsonicMediaProvider) GetPlayQueue() (*mediaprovider.SavedPlayQueue, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user