summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill Höppner2018-04-22 11:06:58 +0200
committerTill Höppner2018-04-22 11:06:58 +0200
commit0ce1c686ae54347039d770758bea1c2027f68bc3 (patch)
tree6d82a6c865d27e1013a537b0f6fee0617b4f66d1
parentbd9026fa09bd3d9dffd680d09e94a41852f45525 (diff)
downloadzsh-0ce1c686ae54347039d770758bea1c2027f68bc3.tar.gz
zsh-0ce1c686ae54347039d770758bea1c2027f68bc3.tar.xz
zsh-0ce1c686ae54347039d770758bea1c2027f68bc3.zip
youtube-dl: variable format with fallback to opus
-rw-r--r--conf.d/99-youtube-dl.zsh12
1 files changed, 8 insertions, 4 deletions
diff --git a/conf.d/99-youtube-dl.zsh b/conf.d/99-youtube-dl.zsh
index 8e572a5..c3f6483 100644
--- a/conf.d/99-youtube-dl.zsh
+++ b/conf.d/99-youtube-dl.zsh
@@ -1,14 +1,18 @@
function download_audio() {
+ format="$1"
+ shift
+
youtube-dl \
- --extract-audio --audio-format vorbis --audio-quality 0 --no-call-home \
- --restrict-filenames --ignore-errors --add-metadata $@
+ --extract-audio --audio-format "$format" --audio-quality 0 --no-call-home \
+ --restrict-filenames --ignore-errors --add-metadata "$@"
}
function rip() {
+ : "${format:=opus}"
if [ "$#" -ne 1 ]; then
- download_audio $(xclip -o)
+ download_audio "$format" $(xclip -o -selection clipboard)
else
- download_audio $@
+ download_audio "$format" "$@"
fi
}