dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles # fast
git clone https://src.adamsgaard.dk/dotfiles.git # slow
Log | Files | Refs | README | LICENSE Back to index

mpc-random-album.sh (328B)


      1 #!/bin/sh
      2 set -e
      3 if [ $# -gt 0 ]; then
      4 	host="$1"
      5 else
      6 	host="localhost"
      7 fi
      8 a="$(mpc -q --host "$host" list album | sort -R | head -1)"
      9 mpc -q --host "$host" clear
     10 mpc -q --host "$host" findadd album "$a"
     11 if ! pgrep ncmpc >/dev/null 2>&1; then
     12 	printf '# %s\n' "$a"
     13 	mpc -q --host "$host" playlist
     14 fi
     15 mpc -q --host "$host" play