Show current MPD file
authorSiraaj Khandkar <siraaj@khandkar.net>
Tue, 3 Jul 2018 21:25:21 +0000 (17:25 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Tue, 3 Jul 2018 21:25:21 +0000 (17:25 -0400)
bin/khatus_show

index 03ad6a9..f008d19 100755 (executable)
@@ -342,6 +342,19 @@ mpd_state=$(
         '
 )
 
+mpd_current_file=$(
+    echo 'currentsong' \
+    | nc 127.0.0.1 6600 \
+    | awk -v max_chars=10 '
+        /^file:/ {
+            file = $2
+            for (i=3; i<=NF; i++) {file = file " " $i}
+            last = split(file, parts, "/")
+            print substr(parts[last], 1, max_chars)
+        }
+        '
+)
+
 echo \
 "\
  E$energy\
@@ -370,7 +383,7 @@ echo \
  \
  V=$volume\
  \
$mpd_state\
[$mpd_state $mpd_current_file]\
  \
  $signal_last_msg_age\
  \
This page took 0.024784 seconds and 4 git commands to generate.