meltaxa / musicfig

A Raspberry Pi jukebox that uses LEGO Dimensions and Minifigures to play Spotify or MP3 tracks.
https://musicfig.com
MIT License
22 stars 9 forks source link

Pause and resume playing functionality #2

Closed zork32 closed 4 years ago

zork32 commented 4 years ago

First of all, thank you for this cool project. My Question: I want to implement a pause and resume functionality. When removing the NFC tag it should pause the playback. When insert the same NFC tag again, the playback should continue at the same position. Is this easily possible with the used libraries?

meltaxa commented 4 years ago

Hi @zork32, it is indeed possible to do by watching for the tag "removed" status and calling the Spotify blueprint pause function. Pausing MP3 files will be challenging with the current procedures. Consideration to which tag is removed and only pausing the currently playing tag should be made. For example, if both Ironman and Emmet are on the pads with Ironman playing, only removing the Ironman tag should pause the track. Removing Emmet should do nothing.

zork32 commented 4 years ago

Hi @meltaxa, thank you for your quick response.

"...Consideration to which tag is removed and only pausing the currently playing tag should be made. For example, if both Ironman and Emmet are on the pads with Ironman playing, only removing the Ironman tag should pause the track. Removing Emmet should do nothing."

Exactly! For me it would be fine if this functionality would only work with one NFC tag on the pad.

My setup is currently: No plugged Monitor, autostart app over LXSession and use of mp3 only.

meltaxa commented 4 years ago

@zork32, I've added the pause and resume functionality to Spotify tracks and MP3 files. Test by checking out and pulling the code from the feature-music-pause-and-resume branch.

meltaxa commented 4 years ago

Made a few more enhancements, mostly with making the interactions more robust.

meltaxa commented 4 years ago

Also if in "MP3 only mode" (ie. no Spotify), you no longer need to visit the app web page after startup. The README quick install instructions has been updated to reflect this.

meltaxa commented 4 years ago

Merged to master.