Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

helen
Copy link
Owner

@helen helen commented Dec 31, 2021

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
Copy link
Owner Author

helen commented Dec 31, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant