aboutsummaryrefslogtreecommitdiff
path: root/modules/mpd
diff options
context:
space:
mode:
authorArchie Hilton (thytom) <archie.hilton1@gmail.com>2019-10-21 23:51:27 +0100
committerArchie Hilton (thytom) <archie.hilton1@gmail.com>2019-10-21 23:51:27 +0100
commite611703e037621493ead5a4c6d4debbdf4597904 (patch)
treecafd929b2e1ec9e1830056c34b5384a1a1feccdc /modules/mpd
parent63399b33197214c10f2477ee400f2546edda920c (diff)
Added volumebar and mpd modules.
Diffstat (limited to 'modules/mpd')
-rwxr-xr-xmodules/mpd24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/mpd b/modules/mpd
new file mode 100755
index 0000000..5db0d64
--- /dev/null
+++ b/modules/mpd
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+PREFIX_PLAY=' '
+PREFIX_PAUSE=' '
+
+get_mpd()
+{
+ current_song=$(mpc current)
+
+ if [[ "$current_song" = "" ]]; then
+ exit 0
+ else
+ playpause=$(mpc | awk '/\[.*]/{split($0, a, " "); print a[1]}')
+ if [[ "$playpause" = "[playing]" ]]; then
+ current_song=$PREFIX_PLAY$current_song
+ elif [[ "$playpause" = "[paused]" ]]; then
+ current_song=$PREFIX_PAUSE$current_song
+ fi
+ fi
+
+ echo $current_song
+}
+
+get_mpd