1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- # variables
- mpc="/usr/bin/mpc -h $mpd_host"
- # functions
- function play_folder {
- tag = $1
- mkdir -p /music/$tag
- 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 "$mpd_folder$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
- }
|