diff options
Diffstat (limited to 'music_status')
-rwxr-xr-x | music_status | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/music_status b/music_status new file mode 100755 index 0000000..54af8fb --- /dev/null +++ b/music_status @@ -0,0 +1,27 @@ +#!/bin/sh +#Script that writes the current mpd status +#To be called by a remote device + +SSH_HOST='aberrant@ceres.local' +REMOTE_PORT_COMMAND="\$(arduino-cli board list | grep dev | grep -o '^\S*')" +LAST_VAL="" +while true +do + STATUS=$(mpc status | grep paused) + if [ -z "$STATUS" ]; + then + SONG=$(mpc current) + if [ "$SONG" != "$LAST_VAL" ]; + then + ssh "$SSH_HOST" "echo m$SONG > $REMOTE_PORT_COMMAND" + LAST_VAL="$SONG" + fi + else + if [ "PAUSED" != "$LAST_VAL" ]; + then + ssh "$SSH_HOST" "echo mPAUSED > $REMOTE_PORT_COMMAND" + LAST_VAL="PAUSED" + fi + fi + sleep 5 +done |