Finding, fixing, and synchronizing all your MP3 music album art MOSTLY automatically (BASH script)

I like album covers — enough that I keep writing programs to display them.

The problem is, my MP3s come from all over the place. I literally have music files originally recorded from the radio, onto cassette, and then encoded into MP3.

So my album art is … not always great.

Some MP3s were missing embedded art. Some had different covers embedded in the files than were in the cover.jpg and folder.jpg files in the album directory. Some were missing album art altogether. And with a digital music library as large as mine… that’s a lot to double check.

That’s what computers are for.

I wrote a script to finally fix those f’in covers in your music directory and to synchronize them between cover.jpg, folder.jpg and what’s embedded in the file. (Standard disclaimer: It worked on my system and files, I’ve done my best to catch edge cases, but backup your files first or use --safe.)

If they all match, it will ensure they’re all the same. If one or more locations is missing the cover, it will add it there. (Including embedded in the MP3 with --autoembed.

If the cover.jpg, folder.jpg, or embedded cover differ, it will present them to you (with an audible alarm if you use --ping) so that you can select the correct one. If you choose none of them, it will search online for cover art.

If you use --safe it will merely output what commands it would run.

If you use --remove it will remove existing covers from MP3s before adding the chosen cover.

If you use --loud it will spit a lot of stuff out onto the terminal. Some sub-commands output text to $STDOUT whether I want them to or not.

If you use --checkall, it will prompt you to confirm each album cover, even if it all matches.

You can also force it to search online for each album using --everything, which implies --checkall in practice, as the checksum of a downloaded cover probably is slightly different than what you have.

Which sounds like a lot, but you can point f_fix_covers.sh at your entire music collection, or just at a specific album directory. Feed the ones you want to check in one at a time with xargs if you feel like it.

Two important notes:

  1. This script assumes that each directory contains the same album, even if the artists are different. You will get wrong results if you have a bunch of different MP3s from different albums in the same directory.
  2. If there is a single existing cover — or single version, rather — in the directory, the script assumes it is correct and will automatically assume that it is the correct cover. If you want to verify existing covers, use --checkall or --everything.

You can find the script in my yolo-mpd repository on GitHub, GitLab, or my personal git repository.

Featured Image by Enzo Abramo from Pixabay