skynet/greg/greg-dl.sh

23 lines
568 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
outfile=$1
uri=$(perl -MURI::Escape -e 'print uri_escape shift, , q{^A-Za-z0-9\-._~/:}' -- "$2")
podname=$3
epname=$4
year=$(awk -F- '{ print $1 }' <<<"$5")
if [ ! -f "$outfile" ]; then
# download the episode
curl -sSLo "$outfile" "$uri"
# clear all tags from file
id3 -1 --delete "$outfile"
id3 -2 --delete "$outfile"
id3 -3 --delete "$outfile"
# write podcast tags
id3 -2 --genre "Podcast" --year "$year" --album "Podcast: $podname" --artist "Podcast" --frame=TPE2 "Podcast" --title "$epname" "$outfile"
fi