summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-12-03 05:08:30 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-12-03 05:10:51 +0100
commitb62fc8acc683aaaa7ae24552ed5b5129378318ad (patch)
tree539bf638608b58a5c4493e990a849f311ec23011
parent7389fdf0e7944027c89f81fe3c2b961cafb7f99c (diff)
downloadpc-b62fc8acc683aaaa7ae24552ed5b5129378318ad.tar.gz
pd: Fix escaping, add DOS/Windows support
-rwxr-xr-xpd6
1 files changed, 5 insertions, 1 deletions
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)"