Show mpd state
authorSiraaj Khandkar <siraaj@khandkar.net>
Mon, 2 Jul 2018 21:48:42 +0000 (17:48 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Mon, 2 Jul 2018 21:48:42 +0000 (17:48 -0400)
bin/khatus_show

index d506d3a..fc4415a 100755 (executable)
@@ -289,6 +289,29 @@ signal_last_msg_age=$(
     | tr -d ' '
 )
 
+mpd_state=$(
+    echo 'status' \
+    | nc 127.0.0.1 6600 \
+    | awk '
+        {
+            status[$1] = $2
+        }
+
+        END {
+            state = status["state:"]
+            symbol = "-"
+            if (state == "play") {
+                symbol = "▶"
+            } else if (state == "pause") {
+                symbol = "❚❚"
+            } else if (state == "stop") {
+                symbol = "⬛"
+            }
+            printf("%s", symbol)
+        }
+        '
+)
+
 echo \
 "\
  E$energy\
@@ -315,6 +338,8 @@ echo \
  W:[$wifi $(echo "$io_net" | awk '/^wlp3s0/ {print $2, $3}')]\
  \
  \
+ $mpd_state\
+ \
  $signal_last_msg_age\
  \
  $weather\
This page took 0.021623 seconds and 4 git commands to generate.