From: Siraaj Khandkar Date: Tue, 3 Jul 2018 21:25:21 +0000 (-0400) Subject: Show current MPD file X-Git-Url: https://git.xandkar.net/?p=khatus.git;a=commitdiff_plain;h=94fb2cd73b7929db578e0fff31e720210c6d1ca1 Show current MPD file --- 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\ \