diff --git a/cliplumber b/cliplumber index 99a9c2f..263bfab 100755 --- a/cliplumber +++ b/cliplumber @@ -15,9 +15,13 @@ case "$choice" in "qr") printf "%s" "$clip" | qrencode -o - | feh -. -Z --geometry 400x400 - ;; - "download") - cd ~/mus || exit - youtube-dl -x --audio-format mp3 --no-playlist -o "%(title)s.%(ext)s" "$clip" + # Download supports optional folder target + "download"*) + path="$HOME/mus/$(printf "%s" "$choice" | cut -d " " -f 2-)" + [ -d "$path" ] || mkdir -p "$path" + cd "$path" || exit + youtube-dl -x --audio-format mp3 --no-playlist -o "%(title)s.%(ext)s" "$clip" || + notify-send "Error while downloading: $clip" ;; "play") mpv --ytdl-format='bestvideo[height<=?1080]+bestaudio/best' "$clip" @@ -26,6 +30,6 @@ case "$choice" in st -e mpv --ytdl-format=bestaudio ytdl://ytsearch:"$clip" ;; *) - printf "Nope\n" + printf 'Nope\n' ;; esac