summaryrefslogtreecommitdiffstats
path: root/bin/dynmpd
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2012-08-11 02:40:34 +0200
committerRasmus Steinke <rasi@xssn.at>2012-08-11 02:40:34 +0200
commitf140a1642ebfde198946ad6760c1003c1cb9a8c3 (patch)
tree7538aa90092f99c661ec3abb4a69944767315dc5 /bin/dynmpd
parente3fd45703267ce67d8b1e1fb53a4a1b4ccda551e (diff)
downloaddotfiles-f140a1642ebfde198946ad6760c1003c1cb9a8c3.tar.gz
dotfiles-f140a1642ebfde198946ad6760c1003c1cb9a8c3.tar.xz
scripts
Diffstat (limited to 'bin/dynmpd')
-rwxr-xr-xbin/dynmpd22
1 files changed, 22 insertions, 0 deletions
diff --git a/bin/dynmpd b/bin/dynmpd
new file mode 100755
index 0000000..0509cf2
--- /dev/null
+++ b/bin/dynmpd
@@ -0,0 +1,22 @@
+#!/bin/bash
+TIMEOUT=5
+CONSUME=`mpc | tail -1 | awk '{print $(NF-0)}'`
+mpc load "$1" && mpc play
+
+if [[ $CONSUME == "off" ]]; then
+ mpc consume && echo "Activating Consume Mode";
+else
+ echo "Consume Mode already active"
+fi
+
+while(true); do
+ITEMS=`mpc playlist | wc -l`
+if [ $ITEMS -le "0" ] ; then
+ mpc load "$1"
+ echo "adding new songs from lastfm"
+ mpc play;
+else
+ echo "nothing to do"
+fi
+sleep $TIMEOUT
+done