Last active
September 4, 2022 23:55
-
-
Save rkitover/d852abc4912b409b840948e0a0195294 to your computer and use it in GitHub Desktop.
shell function to play a cd from a collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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