123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- mpc="/usr/bin/mpc -h $mpd_host"
- music="/music/"
- function mpd_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 "$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_stop {
- $mpc stop
- }
- function mpd_pause_play {
- if ($mpc | grep -q playing); then
- $mpc pause
- else
- $mpc play
- fi
- }
- function vol_min {
- mpd_set_volume 5
- }
- function mpd_med {
- mpd_set_volume 50
- }
- function mpd_vol_max {
- mpd_set_volume 75
- }
- function mpd_set_volume {
- if [ -n "$1" ]; then
- $mpc volume $1
- fi
- }
- function _ensure_volume_10 {
- if (( $($mpc volume | grep -o '...%' | tr -d '%') < 10 )); then
- mpd_set_volume 10
- fi
- }
|