# Add /usr/local/bin to PATH
export PATH=$PATH:/usr/local/bin

# f is the full file name including path
f="$1"

# fn is the file name with extension but no path
fn=$(basename "$f")

# fns is the short file name, with no extension, no path
fns=${fn%.*}

# query current ID3 tags if necessary with: id3v2 -l "$f"
# remove current ID3 tags when testing with: id3v2 -D "$f"

# Add album artwork
ffmpeg -i "$f" -i /Users/allison/podfeet/NosillaCast/NosillaCast\ Audio/CCATP_AUDIO_2018/ccatp-logo.png -map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" /Users/allison/podfeet/NosillaCast/NosillaCast\ Audio/CCATP_AUDIO_2018/out.mp3

# Copy file with artwork back onto the original

/bin/mv /Users/allison/podfeet/NosillaCast/NosillaCast\ Audio/CCATP_AUDIO_2018/out.mp3 "$f"

id3v2 --WPUB https://podfeet.com "$f"
id3v2 --TIT2 "$fns" "$f"
id3v2 --TPE1 "Allison Sheridan" "$f"
id3v2 --TALB "Chit Chat Across the Pond" "$f"	id3v2 --TYER 2018 "$f"
id3v2 --TCON Podcast "$f"
id3v2 --TCOP "Creative Commons Share and Share Alike no commercial use with attribution" "$f"

# Output a list of the tags applied
id3v2 -l "$f"
# Output the final file name
echo "$f"
