Files
docs
global
py
zsh
aws
config
db
git
i3
latex
memo
redis
scwrypts
utils
vim
youtube
README.md
common.zsh
download
get-audio-clip
README.md
common.zsh
hello-world
zx
.env.template
.env.template.descriptions
.gitattributes
.gitignore
LICENSE
README.md
run
scwrypts
scwrypts.plugin.zsh
scwrypts/zsh/youtube/download

26 lines
700 B
Plaintext
Raw Normal View History

#!/bin/zsh
_DEPENDENCIES+=()
_REQUIRED_ENV+=()
source ${0:a:h}/common.zsh
#####################################################################
DOWNLOAD_VIDEO() {
local URLS=($@)
[[ ${#URLS[@]} -eq 0 ]] && URLS=($(echo '' | __FZF_HEAD 'enter URL'))
[[ ${#URLS[@]} -eq 0 ]] && __ABORT
local FILENAME=$(YT__GET_FILENAME $URLS)
[ ! $FILENAME ] && __ERROR "unable to download '$URLS'"
__SUCCESS "Found '$FILENAME'"
__Yn "Proceed with download?" || return 1
YT__DOWNLOAD $URLS \
&& __SUCCESS "downloaded to '$YT__OUTPUT_DIR/$FILENAME'" \
|| { __ERROR "failed to download '$FILENAME'"; return 2; }
}
#####################################################################
DOWNLOAD_VIDEO $@