summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-12-03 04:23:42 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-12-03 04:26:47 +0100
commit7389fdf0e7944027c89f81fe3c2b961cafb7f99c (patch)
tree7aace06d6f2eaf838c9362495723b1a93a04ccdf
parentd489e722120ee3db6c2d72591ab8e1958f744fa8 (diff)
downloadpc-7389fdf0e7944027c89f81fe3c2b961cafb7f99c.tar.gz
pd: Name downloaded file after episode title
-rwxr-xr-xpd7
1 files changed, 6 insertions, 1 deletions
diff --git a/pd b/pd
index 7bcaead..b76f1d0 100755
--- a/pd
+++ b/pd
@@ -2,4 +2,9 @@
# pd -- download podcast episode(s)
-curl -Z `sed -n 's/Link: /-OJL /p'`
+eval curl -ZL "$(sed -n 's/^Title: \|File: //p' |
+sed 's/ / /g; s/\\/\\\\/g; '"s/'/\\\\'/g" |
+paste - - |
+while IFS=' ' read title file; do
+ printf "-o '%s' '%s' " "$title.${file##*.}" "$file"
+done)"