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

Push button to start playing a playlist/stream sample code #340

Closed
sassen opened this issue Nov 20, 2018 · 9 comments
Closed

Push button to start playing a playlist/stream sample code #340

sassen opened this issue Nov 20, 2018 · 9 comments

Comments

@sassen
Copy link

sassen commented Nov 20, 2018

Hi, is it possible to have a few dedicated push buttons for the most used playlists/streams on top of having the RFID card functionallity?

I only find instructions for GPIO buttons for play/stop, skip song, volume etc but nothing for playback of playlist/web radio stream.

@MiczFlor
Copy link
Owner

That could be hacked in. For one specific playlist. You would need to execute a bash script which imcludes the folder name. See top of this script for examples:
https://github.com/MiczFlor/RPi-Jukebox-RFID/blob/master/scripts/rfid_trigger_play.sh
Use double quotes for a folder name with whitespaces
Looking forward to your working prototype. Please post it here.
All the best, micz

@Bartman83
Copy link

Hallo Micz, i´m not good in coding, so i don`t know exactly which solution you prefer but i would try a workaround:

  • I track a playlist with a card
  • than i would add the following code in gpio-buttons.py
    def def_play1(): check_call("./rfid_trigger_play.sh --cardid=1234567890", shell=True) play1 = Button(4,pull_up_True) play1.when_pressed = def_play1

I try it out when i bulid my next Box. Maybe someone think about my solution and give me a feedback.
Thank you so much for JukeBox4Kids!
Greets
Barti

@Bartman83
Copy link

Ok. It works. A my idea ist quiet simple and has the advantage that i can easily change the assignment to the button.

Here the again which i add to gpio-buttons.py:

`def def_raab():
check_call("./scripts/rfid_trigger_play.sh --cardid=0005238085", shell=True)
def def_fsam():
check_call("./scripts/rfid_trigger_play.sh --cardid=0005222302", shell=True)
def def_bobo():
check_call("./scripts/rfid_trigger_play.sh --cardid=0005256911", shell=True)

raab = Button(17,pull_up=True)
fsam = Button(27,pull_up=True)
bobo = Button(22,pull_up=True)

raab.when_pressed = def_raab
fsam.when_pressed = def_fsam
bobo.when_pressed = def_bobo`

@carver79
Copy link

Perfect - great someone did it. And a good solution for non-coders like me.
Going to try it the next days.
Thanks!

@MiczFlor
Copy link
Owner

Hi @Bartman83
thanks for the code example. This is roughly what I had in mind with no time to write it :) If you could add this to the wiki, I would be very happy. Otherwise, I'll try to add it some time soon.
All the best, micz

@MiczFlor MiczFlor changed the title Push button to start playing a playlist/stream? Push button to start playing a playlist/stream sample code Nov 22, 2018
@sassen
Copy link
Author

sassen commented Nov 23, 2018 via email

@MiczFlor
Copy link
Owner

Hi @Bartman83
I added your example to the wiki:
https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/Hack-Playlist-triggered-by-GPIO-Button
thanks for the contribution!

@alanrodriguezdotme
Copy link

I've been able to get the jukebox controls working with the GPIO buttons, but I'm having trouble implementing the playlist controls. Here's what I have in my gpio-buttons.py:
image

I've tripled checked the GPIO connections are correct, and they are. I've even tried changing the buttons. No luck.

@alanrodriguezdotme
Copy link

Lol. Everytime I post an issue, my problem seems to magically get resolved. I rebooted it a couple times and it works now. 🤷🏽‍♂️

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

No branches or pull requests

5 participants