Skip to content

Instantly share code, notes, and snippets.

@rkitover
Last active September 4, 2022 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkitover/d852abc4912b409b840948e0a0195294 to your computer and use it in GitHub Desktop.
Save rkitover/d852abc4912b409b840948e0a0195294 to your computer and use it in GitHub Desktop.
shell function to play a cd from a collection
ttf() {
if [ -z "$1" ]; then
echo >&2 Please specify CD number
return 1
fi
_cd_num=$1
set --
_dir=$(echo ~/Music/Tunnel*/*_${_cd_num}-*)
_i=0
for _mp3 in "$_dir"/*.mp3; do
_i=$((_i + 1))
set -- "$@" $_i "${_mp3##*/}"
done
whiptail=whiptail
if ! command -v whiptail >/dev/null; then
whiptail=dialog
fi
_cd=$($whiptail --title "Tunnel Trance Force Volume $_cd_num" --menu "Choose CD to play:" 15 70 $_i "$@" 3>&1 1>&2 2>&3)
[ $? != 0 ] && return 1
_cd_file=$(eval echo \$"$((_cd * 2))")
mpv "${_dir}/${_cd_file}"
unset _cd_num _dir _i _mp3 _cd _cd_file
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment