Hi,
Is there a way to make mopidy play a sound (like a beep) every n seconds when nothing else is playing? I regularly forget to switch of my HIFI when leaving the house.
Hi,
Is there a way to make mopidy play a sound (like a beep) every n seconds when nothing else is playing? I regularly forget to switch of my HIFI when leaving the house.
There’s nothing I know of that does this currently, but you could write a script or even Mopidy extension that did this.
For a script, check Mopidy’s status to see if it’s playing something (or use MPD’s idle
command), if not then play your beep sound and sleep for n seconds. The mpc
program in conjunction with Mopidy-MPD makes writing these scripts quite simple.
In case anyone else is interested; here is a simple implementation of it:
#!/bin/bash
while true
do
eval STATE=$(curl -d '{"jsonrpc": "2.0", "id": 1, "method": "core.playback.get_state"}' -H 'Content-Type: application/json' http://YOUR_IPADDRESS:6680/mopidy/rpc|jq .result)
[ "$STATE" != "playing" ] && speaker-test -l 1 -t wav
sleep 30
done
I start this from /etc/rc.local
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.