From b62fc8acc683aaaa7ae24552ed5b5129378318ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 3 Dec 2020 05:08:30 +0100 Subject: pd: Fix escaping, add DOS/Windows support --- pd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pd b/pd index b76f1d0..354991b 100755 --- a/pd +++ b/pd @@ -2,9 +2,13 @@ # pd -- download podcast episode(s) +u= +test "$1" = -u && u=1 # unix mode + eval curl -ZL "$(sed -n 's/^Title: \|File: //p' | -sed 's/ / /g; s/\\/\\\\/g; '"s/'/\\\\'/g" | +sed 's/ / /g; s/\\/\\\\/g; '"s/'/'\"'\"'/g" | paste - - | while IFS=' ' read title file; do + test -z "$u" && title=`printf '%s\n' "$title" | sed 's/\\\\/./g; s,[/:*<>|],.,g; s/?//g; '"s/\"/'\"'\"'/g"` # dos/windows (default) printf "-o '%s' '%s' " "$title.${file##*.}" "$file" done)" -- cgit v1.2.3