swipe-jukebox icon indicating copy to clipboard operation
swipe-jukebox copied to clipboard

[do not merge] Example of adding swipes to the queue instead

Open helen opened this issue 3 years ago • 1 comments

If you execute mpc play when a track is currently playing it will restart that track, so we have to be smart and only tell it to start playing if it wasn't already playing. The seemingly easier way to do this isn't by parsing out the status but rather by counting how many songs are in the queue.

Potential problem: if you have paused and forgotten that it's paused, it will add to the queue but will not start playing. This is where parsing out the status might be better after all.

helen avatar Dec 31 '21 03:12 helen

And then I realized another problem: playlists are sticky in MPD, meaning they don't clear when it finishes playing (nothing is popped off the top of the stack). So in reality parsing the output of mpc status is going to have to happen. The logic is probably something like this:

  1. Upon swipe, check to see if something is currently playing or paused (output starts with [playing] or [paused].
  2. If neither, clear the queue.
  3. Add the swiped item.
  4. If not already currently playing, start playing.

It will be kind of weird if playback is currently paused and you swipe a card and it starts playing something else but I think that's just going to have to be the nature of a headless system with a queue. You can see what's up in the web UI, at least. Might also want to consider making cards for clearing queue, previous, and next.

helen avatar Dec 31 '21 03:12 helen