2023-02-21 18:44:27 -07:00
|
|
|
#!/bin/zsh
|
|
|
|
|
use media/youtube
|
|
|
|
|
#####################################################################
|
|
|
|
|
|
2024-02-06 14:06:44 -07:00
|
|
|
MAIN() {
|
2023-02-21 18:44:27 -07:00
|
|
|
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; }
|
|
|
|
|
}
|