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

Run script or executable on connection, disconnection, play and stop etc #329

Closed
aleszczynskig opened this issue Mar 13, 2021 · 6 comments
Closed
Labels
enhancement New feature or request

Comments

@aleszczynskig
Copy link

Is your feature request related to a problem? Please describe.
Would you be able to implement a feature to execute an external script or executable specified in the config file on connection, disconnect, when starting playback, changing track, pausing or stopping?

Describe the solution you'd like
Ability to execute a different script depending for each type or event. This would be useful, for example, when connecting to trigger the system to connect to some speakers, preset a mixer or even integrate with other systems, such as home-assistant. I would provide a wealth of opportunities for some very cool integrations/features.

Describe alternatives you've considered
I do not believe there are any.

Additional context

@aleszczynskig aleszczynskig added the enhancement New feature or request label Mar 13, 2021
@aleszczynskig aleszczynskig changed the title Run script of executable on connection, disconnection, play and stop etc Run script or executable on connection, disconnection, play and stop etc Mar 14, 2021
@devgianlu
Copy link
Member

Does this suit you? There could also be the possibility to pass additional data to the program with environment variables or parameters.

@aleszczynskig
Copy link
Author

aleszczynskig commented Mar 14, 2021

Wow. Fast work. Thank you. It looks fully featured. I will test today as soon as I can and report my findings back. Is the capability to pass parameters to the scripts already implemented or is that a future enhancement?

@devgianlu
Copy link
Member

devgianlu commented Mar 14, 2021

Could be a future enhancement, some data structures are complex so it really depends on what one might need. Starting with what you need is ok.

@aleszczynskig
Copy link
Author

Just attempting to try this out. I cannot seem to get the events to trigger. I am unsure if this is related to the user setup for spocon or something else. I am trying to use the logs to check if the commands are issued or not but I can't see anything. Should this be recorded in the logs? I tried to read the code but my java is not great and I couldn't see any obvious logging.

@devgianlu
Copy link
Member

I forgot to enable shell events when starting in API mode, which spocon uses. Should be good now.

@aleszczynskig
Copy link
Author

Thanks for the fix. It seems to be working with the api now. I have not tested all of the event types though.

Thanks for the quick implementation. Great job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants