Skip to content

Commit

Permalink
Refill
Browse files Browse the repository at this point in the history
  • Loading branch information
abs3nt committed Aug 22, 2024
1 parent e05de59 commit 57c97cd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/commands/radio.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,24 +365,25 @@ func (c *Commander) RefillRadio() error {
if err != nil {
return err
}
paused := false
if !status.Playing {
return nil
paused = true
}
toRemove := []spotify.ID{}
radioPlaylist, db, err := c.GetRadioPlaylist("")
if err != nil {
return err
}

if status.PlaybackContext.URI != radioPlaylist.URI {
return nil
}

playlistItems, err := c.Client().GetPlaylistItems(c.Context, radioPlaylist.ID)
if err != nil {
return fmt.Errorf("orig playlist items: %w", err)
}

if status.PlaybackContext.URI != radioPlaylist.URI || paused {
return c.RadioFromPlaylist(radioPlaylist.SimplePlaylist)
}

page := 0
for {
tracks, err := c.Client().GetPlaylistItems(c.Context, radioPlaylist.ID, spotify.Limit(50), spotify.Offset(page*50))
Expand Down

0 comments on commit 57c97cd

Please sign in to comment.