Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Automation scripts?
#1
Hi I am new to moodeaudio but would like to know if it’s possible to have automation scripts that can be triggered when particular events happen - specifically I would like to run a script which might use Mpc to select a play, set a volume level ( and maybe a few other tasks ) when a Bluetooth or airplay device connects - ideally a different script for different devic “name” or a single script that could use an api to query which device is connected and customise what I would like to happen when the device connect!

If this type of capability is already available I apologise but I could not find anything mentioned ( other than a startup script ) 

Thanks
Reply
#2
The event scripts for Spotify, Airplay and Squeezelite are located in /var/local/www/commandw/
The event script for incoming Bluetooth connections is /usr/local/bin/a2dp-autoconnect

MPD can be controlled via a simple command API thats described in the Setup Guide
https://github.com/moode-player/moode/bl.../setup.txt
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
(12-26-2021, 01:23 AM)Tim Curtis Wrote: The event scripts for Spotify, Airplay and Squeezelite are located in /var/local/www/commandw/
The event script for incoming Bluetooth connections is /usr/local/bin/a2dp-autoconnect

MPD can be controlled via a simple command API thats described in the Setup Guide
https://github.com/moode-player/moode/bl.../setup.txt

Thanks for this - Is there a full list of commands that can be executed? I can see the stop / start, refresh the playlist but specifically I am looking at using Moode as a Bluetooth music 'server' - basically instead of a bluetooth rendered (I would always using Airplay on iOS and either Chromecast or UPNP on Android) - so what I was thinking of doing was when one of my Bluetooth speakers connects that it would send the output to the speaker (rather than sent to the local output). I can see this option under the Bluez configuration- but changing it manually stop all the output going to the normal connected speakers so I would like to have a bluetooth join script would would change this configuration of the bluetooth output, start a playlist, maybe set the volume etc and therefore automatically play the given playlist on the speaker. When the speaker disconnects I would like to restore the settings back to the normal.

I can mostly how to do this but not the switch of Bluetooth output away from local only when a bluetooth device connects?
Reply
#4
The code that accomplishes the switch between MPD -> Local and MPD => Bluetooth is in /var/www/blu-config.php. Look for the comment // Change MPD audio output.

You might be able to make a PHP script containing this code and call it from /usr/local/bin/a2dp-autoconnect but I have no idea whether this would actually work.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: