summaryrefslogtreecommitdiff
path: root/conf.d/99-youtube-dl.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'conf.d/99-youtube-dl.zsh')
-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
}