29 lines
695 B
Plaintext
29 lines
695 B
Plaintext
|
#!/bin/zsh
|
||
|
DEPENDENCIES+=()
|
||
|
REQUIRED_ENV+=()
|
||
|
|
||
|
use media/youtube
|
||
|
|
||
|
CHECK_ENVIRONMENT
|
||
|
#####################################################################
|
||
|
|
||
|
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 $@
|