aboutsummaryrefslogtreecommitdiffstats
path: root/bin/notify_mpd
diff options
context:
space:
mode:
authorDavid Runge <david.runge@frqrec.com>2013-11-03 12:30:45 +0100
committerDavid Runge <david.runge@frqrec.com>2013-11-03 12:30:45 +0100
commit67b0ec5741d327d27afe88783d85fcf2c4c4f204 (patch)
tree4ea47807c5e775927b96eb79933c09fbfcd0468e /bin/notify_mpd
downloaddotfiles-67b0ec5741d327d27afe88783d85fcf2c4c4f204.tar.gz
dotfiles-67b0ec5741d327d27afe88783d85fcf2c4c4f204.tar.bz2
dotfiles-67b0ec5741d327d27afe88783d85fcf2c4c4f204.tar.xz
dotfiles-67b0ec5741d327d27afe88783d85fcf2c4c4f204.zip
First commit
Diffstat (limited to 'bin/notify_mpd')
-rwxr-xr-xbin/notify_mpd45
1 files changed, 45 insertions, 0 deletions
diff --git a/bin/notify_mpd b/bin/notify_mpd
new file mode 100755
index 0000000..36d8345
--- /dev/null
+++ b/bin/notify_mpd
@@ -0,0 +1,45 @@
+#!/bin/bash
+mpc "$@" > /dev/null
+lines=`mpc | wc -l`
+
+if [ $lines -gt 1 ];
+then
+ line1="`mpc | head -n 1`"
+ line2="`mpc | head -n 3 | tail -n 2 | sed 's/[a-z]*\:\ off//g'`"
+
+ status="`echo $line2 | awk '{ print $1 }'`"
+ position="`echo $line2 | awk '{ print $3 }'`"
+ position="($position)"
+ volume="[`echo $line2 | awk '{ print $5 $6 }' | sed 's/volume\://' | sed 's/repeat\://'`]"
+
+ repeat="`echo $line2 | grep -c 'repeat: on' | sed 's/1/r/' | sed 's/0//'`"
+ random="`echo $line2 | grep -c 'random: on' | sed 's/1/z/' | sed 's/0//'`"
+ single="`echo $line2 | grep -c 'single: on' | sed 's/1/s/' | sed 's/0//'`"
+ consume="`echo $line2 | grep -c 'consume: on' | sed 's/1/c/' | sed 's/0//'`"
+ flags="[$repeat$random$single$consume]"
+
+ title="$line1"
+ text="$status $position $flags $volume"
+
+else
+ line="`mpc | sed 's/[a-z]*\:\ off//g'`"
+
+ volume="[`echo $line | awk '{ print $2 }'`]"
+
+ repeat="`echo $line | grep -c 'repeat: on' | sed 's/1/r/' | sed 's/0//'`"
+ random="`echo $line | grep -c 'random: on' | sed 's/1/z/' | sed 's/0//'`"
+ single="`echo $line | grep -c 'single: on' | sed 's/1/s/' | sed 's/0//'`"
+ consume="`echo $line | grep -c 'consume: on' | sed 's/1/c/' | sed 's/0//'`"
+ flags="[$repeat$random$single$consume]"
+
+ title="not playing"
+ text="$flags $volume"
+fi
+
+## AWESOME
+#echo 'naughty.destroy(notify_mpc)' | awesome-client
+#echo 'notify_mpc=naughty.notify({title = "'$title'", text = "'$text'"})' | awesome-client
+
+## NOTIFY-SEND
+notify-send -t 2000 "$title" "$text"
+