[cliplumber] Add optional download folder, failure notif

This commit is contained in:
lhark 2019-02-15 18:41:54 -05:00
parent fc5456dc78
commit ae43b0bc90

View file

@ -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