summaryrefslogtreecommitdiff
path: root/music_status
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2024-06-11 19:57:39 -0700
committerKai Stevenson <kai@kaistevenson.com>2024-06-11 19:57:39 -0700
commit1b4cafb4cc89f9356dd7421e4174db38a940207c (patch)
tree80ef91330d19981de49262885387a2a1d1e45286 /music_status
parent212022e0468de27389b88ba166f86200bffe54ce (diff)
music status sh
Diffstat (limited to 'music_status')
-rwxr-xr-xmusic_status27
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