Skip to content

Instantly share code, notes, and snippets.

@jmarhee
Created October 6, 2025 15:14
Show Gist options
  • Save jmarhee/56fb58172cdb5d4c5101d56545e9d6ce to your computer and use it in GitHub Desktop.
Save jmarhee/56fb58172cdb5d4c5101d56545e9d6ce to your computer and use it in GitHub Desktop.
#!/bin/bash
## Assumes a filename ${artist} - ${title}.mp3
## If not already in mp3:
# for f in *.m4a; do ffmpeg -i "$f" -vn -ar 44100 -ac 2 -b:a 192k "${f%.*}.mp3"; done
## Assumes album cover art at ./cover.jpg
ALBUM_NAME=$1
ALBUM_ARTIST=$2
for f in *.mp3; do
artist=$(echo "$f" | cut -d '-' -f1)
# Removes file extension from title string, leading whitespace following delimiter:
track=$(echo "$f" | cut -d '-' -f2 | sed -e 's|.mp3||g' -e 's/^[[:space:]]*//')
eyeD3 "$f" --artist="$artist" \
--album-artist="$ALBUM_ARTIST" \
--title="$track"\
--album "$ALBUM_NAME"\
--add-image "cover.jpg:FRONT_COVER"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment