Skip to content

Instantly share code, notes, and snippets.

@sillage
Last active January 11, 2019 20:25
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 sillage/d1e6978ed52b7ad53a08 to your computer and use it in GitHub Desktop.
Save sillage/d1e6978ed52b7ad53a08 to your computer and use it in GitHub Desktop.
MP3 tags with eyeD3
#!/bin/bash
# file format: ARTIST/ALBUM/01-TITLE.mp3
read -p "YEAR? " -n 4 YEAR
ALBUM="${PWD##*/}" # ALBUM=$(basename "${PWD}")
ARTIST=$(echo $(cd .. && echo "${PWD##*/}"))
# help: eyeD3 -h
# delete all
eyeD3 --preserve-file-times --remove-all *.mp3
# artist, album, year and cover
eyeD3 --preserve-file-times --v2 --artist "${ARTIST}" --album "${ALBUM}" --release-year ${YEAR} --add-image Folder.jpg:FRONT_COVER *.mp3
# using input redirection and process substitution (!) to manage punctuation and spaces
# tracknumber
while read file;
do
# only keep tracknumber before `-'
eyeD3 --preserve-file-times --v2 --track ${file%%-*} "${file}";
done < <(ls *.mp3)
# title
while read file;
do
TITLE="${file#*-}"; # remove tracknumber
TITLE="${TITLE%.mp3}"; # remove extension
eyeD3 --preserve-file-times --v2 --title "${TITLE}" "${file}";
done < <(ls *.mp3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment