[cliplumber] Add optional download folder, failure notif
This commit is contained in:
parent
fc5456dc78
commit
ae43b0bc90
1 changed files with 8 additions and 4 deletions
12
cliplumber
12
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
|
||||
|
|
Loading…
Reference in a new issue