ara (907B)
1 #!/usr/bin/env bash 2 # ██████ ██████ ██████ 3 # ░░░░░░██ ░░██░░█ ░░░░░░██ 4 # ███████ ░██ ░ ███████ 5 # ██░░░░██ ░██ ██░░░░██ 6 # ░░████████░███ ░░████████ 7 # ░░░░░░░░ ░░░ ░░░░░░░░ 8 # a d d r a n d o m a l b u m 9 10 # default to adding one album 11 [ $# -eq 0 ] && num=1 || num=$1 12 13 # set path to music and read into array 14 library_dir="$HOME/lib/music/" 15 readarray -d '' library < <(find ${library_dir} -mindepth 2 -maxdepth 2 -type d -print0) 16 17 # get some randomness 18 RANDOM=$$$(date +%s) 19 20 # add _n_ random albums to cmus library 21 for n in $(seq 1 ${num}) ; do 22 random_album=${library[$RANDOM % ${#library[@]}]} 23 cmus-remote -C "add ${random_album}" 24 done