Created
March 30, 2022 19:34
-
-
Save cdzombak/cb94c367c4776c6f052dab104fbfc216 to your computer and use it in GitHub Desktop.
generate YAML header matter for MP3s attached to Jekyll posts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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