Hook (shell or webhook) support for onPlay and onPlaylistAdd and onRating #2931
michaelkrieger
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Proposal: Add a hook where a script can be called (or web request can be called) on an event that happens within Navidrome. For security, if they are shell scripts they should only really be set by an admin, but maybe definable or enabled only per user.
For example, I have a music app that keeps its data in a sqlite database. I could easily have a script which calls a sqlite command
UPDATE playcount = playcount + 1 WHERE file = '%pathfile%'
if Navidrome simply let me call aupdateplaycount.sh '%pathfile%' '%username%'
(or did a webhook HTTP POST) on each play. This could keep my plays up to date between applications by incrementing my playcount. The script could do any translation of Navidrome's file to the other application's file location.Secondary, when I add something to a playlist,
updateplaylist.sh '%pathfile%' 'Acoustic Melodies' '%username'
could similarly let me do some post-processing, like adding the same track to my playlist in another application.Third, when I rate a track, having a hook where I can call
updaterating.sh '%pathfile%' 5 '%username%'
could similarly let me keep track of ratings and update them in other apps like if beets implements rating or having a script which finds a similar track in Apple Music and sets its rating to match.These are the three use cases that I see most useful. There may be others that other folks may think of.
I'd welcome this as a webhook as well which would make a HTTP POST request with a JSON payload if there is concern about triggering shell scripts from Navirdrome. This could then easily be modified into the last.fm scrobbling code, also doing a HTTP POST to another script which could be running.
Beta Was this translation helpful? Give feedback.
All reactions