From 5c5d977b77c5a61800621523b7fbcb59361bb3fc Mon Sep 17 00:00:00 2001 From: DTB Date: Sat, 2 Dec 2023 10:04:49 -0700 Subject: [PATCH] more robust remote handling --- playlist/playlist_package | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/playlist/playlist_package b/playlist/playlist_package index dda0da8..7bc81d0 100644 --- a/playlist/playlist_package +++ b/playlist/playlist_package @@ -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