Implement ONEVENT_COMMAND and ONEVENT_POST_ENDPOINT config options #92
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
librespot supports executing custom scripts when events occur, such as a
session_connect
event. This can be configured via the--onevent
flag,Description
ONEVENT_COMMAND
config option/userscripts/
folder and be made executable viachmod u+x
ONEVENT_POST_ENDPOINT
POST
request with event data to the specified endpoint URL whenever a player event occursjson
encoded and contains all available fields specified by the librespot's player event handlerONEVENT_COMMAND
is set.Related Issue
#91
Motivation and Context
onevent
scripts can be extremely useful, especially when integrating a librespot solution into an external system, such ashomeassistant
, because it allows triggering other events dependent on the state of the Spotify connect reciever. The most common usecase of theonevent
callback is to post the current state of the librespot instance to an external server, which is why this case is implemented directly and get's it's own config option.How Has This Been Tested?
debian:bookworm-slim
base imagenodered
was used as REST server to receive the POST requests