Skip to content

Instantly share code, notes, and snippets.

@cdzombak
Created March 30, 2022 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdzombak/cb94c367c4776c6f052dab104fbfc216 to your computer and use it in GitHub Desktop.
Save cdzombak/cb94c367c4776c6f052dab104fbfc216 to your computer and use it in GitHub Desktop.
generate YAML header matter for MP3s attached to Jekyll posts
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "usage: rss-media-info path/to/attachment.mp3"
exit 1
fi
read -r -d '' retv <<EOF
itunes_duration: '$(ffmpeg -i "$1" 2>&1 | grep "Duration:" | cut -d ' ' -f 4 | sed s/,//)'
episode_length: $(stat -f%z "$1")
media_url: $(basename "$1")
EOF
echo "$retv"
echo "$retv" | pbcopy
echo ""
echo "(copied)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment