-
Notifications
You must be signed in to change notification settings - Fork 653
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
--onevent documentation #185
Comments
As far as I could test, you get passed a "start" or "stop" value through environment variable PLAYER_EVENT. So you need to test the value of PLAYER_EVENT in your script and decide the appropriate action. |
You can find the code in question at https://github.com/librespot-org/librespot/blob/aa880f8888226a8e5fc6e1e54dfb7cf58176ac95/src/player_event_handler.rs and hopefully it's quite easy to follow. An updated wikipage would be great. We could also look at adding something (short) to the option's help text. |
Yeah thx for the quick help. I worked it out but it was a hard thing to do. I couldn't test for the environment variables because they were in the "raspotify" user account because I use that project which has librespot as it's core. Update of the wikipage as well as the help text should not be that much work and it's pretty easy to use if it's standalone librespot. |
@DavidM42 Can you share the python code you use to grab the playback state? I am also using raspotify and I am trying to figure out a way to integrate Spotify functionality into my background music script. |
This is the very basic shell script I used for testing:
I'm not a python guy, but the equivalent to
The |
@madmodder123 @michaelherger import os
if os.environ['PLAYER_EVENT'] == "start":
os.system("/home/pi/raspberry-remote/send ***** 1 1")
elif os.environ['PLAYER_EVENT'] == "change":
os.system("/home/pi/raspberry-remote/send ***** 1 1")
elif os.environ['PLAYER_EVENT'] == "stop":
os.system("/home/pi/raspberry-remote/send ***** 1 0") |
@DavidM42 File permissons 755 should work fine here (owner has full read write execute, all others have read and execute permissions). The wiki does need some work, Feel free to update bits where you can :) |
@DavidM42 @michaelherger
But nothing gets displayed in the terminal. I feel stupid, and i'm sure it is something simple I am overlooking, help would be appreciated. :) |
Those environment variables are only exposed when one of the events is triggered. You don't run those scripts stand-alone, but tell librespot to call it when an event fires. |
@michaelherger @DavidM42
Over and over... |
This is definitely an issue with the event system, as I'm seeing exactly the same thing when testing out #190. Will try and pinpoint what is causing it. |
Librespot is using onevent instead of onstart and onstop. librespot-org/librespot#185
Update to replace onstart and onstop parameters with librespots onevent parameter. librespot-org/librespot#185
Update to replace onstart and onstop parameters with librespots onevent parameter. librespot-org/librespot#185
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
The documentation describes how to use the apparently older --onstart and --onstop event handler but the help text and the project itself demand a --onevent handler.
Sorry for my Noob question but I couldn't find any info on how to use it in the wiki or anywhre else. I searched for it on the issue tracker,Google,.. but still got no results.
I know there is a help text but it's pretty shortly explained there.
So to break it down could you please instruct me how the explicit event type get's passed and I would be happy to try to update your wiki on this option.
The text was updated successfully, but these errors were encountered: