From 94fb2cd73b7929db578e0fff31e720210c6d1ca1 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Tue, 3 Jul 2018 17:25:21 -0400 Subject: [PATCH] Show current MPD file --- bin/khatus_show | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/khatus_show b/bin/khatus_show index 03ad6a9..f008d19 100755 --- a/bin/khatus_show +++ b/bin/khatus_show @@ -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\ \ -- 2.20.1