Browse Source

renamed folder play func, added pause/play

Toastie 4 years ago
parent
commit
0e158c737e
2 changed files with 10 additions and 2 deletions
  1. 1 1
      rfidac/data/_action_template
  2. 9 1
      rfidac/data/_mpd_helper

+ 1 - 1
rfidac/data/_action_template

@@ -2,7 +2,7 @@
 
 source /opt/_mpd_helper
 tag=`basename "$0"`
-play_folder $tag
+mpd_play_folder $tag
 
 
 # source _mpd_helper if you want to use mpd actions such as:

+ 9 - 1
rfidac/data/_mpd_helper

@@ -2,7 +2,7 @@
 mpc="/usr/bin/mpc -h $mpd_host"
 
 # functions
-function play_folder {
+function mpd_play_folder {
   tag = $1
   mkdir -p /music/$tag
   # Update the directory timestamp to indicate what was the last tag found
@@ -38,6 +38,14 @@ function mpd_stop {
   $mpc stop
 }
 
+function mpd_pause_play {
+  if ($mpc | grep -q playing); then # when playing
+    $mpc pause
+  else 
+    $mpc play
+  fi 
+}
+
 function vol_min {
   mpd_set_volume 5
 }