| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | # variablesmpc="/usr/bin/mpc -h $mpd_host"# functionsfunction play_folder {  tag = $1  mkdir -p /music/$tag  # Update the directory timestamp to indicate what was the last tag found  # Touch the file alone will not update the directory timestamp,  # so we'll need delete and recreate the file  rm /music/$tag/.lastplay  touch /music/$tag/.lastplay  $mpc stop  $mpc clear  $mpc add $mpd_folder$tag  _ensure_volume_10  $mpc play }function mpd_play {  $mpc stop  $mpc clear  $mpc add "$1"  _ensure_volume_10  $mpc play 1}function mpd_play_shuffle {  $mpc stop  $mpc clear  $mpc add "$1"  $mpc shuffle  _ensure_volume_10  $mpc play 1}function mpd_set_volume {  if [ -n "$1" ]; then # non-zero length    $mpc volume $value  fi}function _ensure_volume_10 {  if (( $($mpc volume | grep -o '...%' | tr -d '%') < 10 )); then    mpd_set_volume 10  fi}
 |