1
0

more robust remote handling

This commit is contained in:
dtb 2023-12-02 10:04:49 -07:00
parent a85b27e5fc
commit 5c5d977b77

View File

@ -2,14 +2,22 @@
while read -r resource
do case "$resource" in
*.m3u) "$0" "$resource" >"$resource".tar
*://*) case "$resource" in # remote
*.m3u) file="$(curl -LO -w '%{filename_effective}' \
"$resource")"
"$0" <"$file" >"$file".tar
printf '%s.tar\n' "$file"
;;
*) youtube-dl -f bestaudio "$resource" --id \
&& youtube-dl --get-id "$resource" \
| xargs printf '%s.*\n' \
|| curl -LO -w '%{filename_effective}' \
"$resource"
;;
esac ;;
*.m3u) "$0" <"$resource" >"$resource".tar
printf '%s.tar\n' "$resource"
;;
*://*) youtube-dl -f bestaudio "$resource" --id \
&& youtube-dl --get-id "$resource" \
| xargs printf '%s.*\n' \
|| curl -LO -w '%{filename_effective}' "$resource"
;;
*) printf '%s\n' "$resource"
;;
esac