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

on_song_change_hook triggered for multiple PLAYER_EVENTS #1272

Closed
teddywaweru opened this issue Mar 21, 2024 · 4 comments
Closed

on_song_change_hook triggered for multiple PLAYER_EVENTS #1272

teddywaweru opened this issue Mar 21, 2024 · 4 comments
Labels
bug A functionality or parts of a program that do not work as intended

Comments

@teddywaweru
Copy link

I had anticipated that the on_song_change_hook would be triggered for the PLAYER_EVENT "play", but I have had scenarios where it's triggered for the "preload", "preloading", "endoftrack" and "change" events as well. I'd wanted to use the hook to notify the next song specifically, but it seems to be triggered by multiple events.

@teddywaweru teddywaweru added the bug A functionality or parts of a program that do not work as intended label Mar 21, 2024
@eladyn
Copy link
Member

eladyn commented Mar 21, 2024

Well, you can just filter by the event it is triggered for. So for example in a bash script, you can do:

#!/bin/bash

[ "$PLAYER_EVENT" = "play" ] || exit 0

# rest of script

@teddywaweru
Copy link
Author

It's actually what I required. Thanks.
Still curious on whether it would be feasible to have the filter within spotifyd itself so that it isn't always triggering for each player_event, and users can specify which events they want to hook to in their spotifyd configs.

@eladyn
Copy link
Member

eladyn commented Apr 8, 2024

I think that this would make configuration unnecessarily complicated, when all the functionality is already there. Maybe adding documentation to this option would make it easier to use? Something like #1271?

@teddywaweru
Copy link
Author

Yeah, that's a better solution than overhauling the config. Also, my limited know-how on exported variables made me unable to figure this out initially.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A functionality or parts of a program that do not work as intended
Projects
None yet
Development

No branches or pull requests

2 participants