Skip to content

Instantly share code, notes, and snippets.

@cdzombak
Created March 30, 2022 19:34
Embed
What would you like to do?
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