/ root / pages / coverart.html

You're using an old link! - Thankfully, you no longer need to specify a nonstandard port (8080) to access my site. You could've used the more standard: http://pbrisbin.com/pages/coverart.html.

Coverart


Recently, lolilolicon posted a script on the Arch forums for auto-fetching album art, then symlinking to /tmp/cover.jpg which is at the same time being displayed in conky. A nice script indeed, mpd album art support in conky.

I decided to take it a bit further and create a general purpose album art manager that expands on some of the methods in lolilolicon's script. I'll post a link to his script when I find it, but below I'll outline my version.

What it expects

The script uses three main constants: $mdir, $cdir, and $covr. From here on I will assume they are defined as the defaults: ~/Music, ~/.covers, and cover.jpg and will write the rest of this page as such.

What it does

First, ~/Music is searched for files and the tags of said files are read. It prints this information in ~/.covers/listing.txt as one line per file: "/path/to/file|Artist|Album"

Next, it uses Artist and Album from the list to find and download the cover for that album. If it finds one, it saves it to ~/.covers/Artist_Album.jpg.

Finally, it goes back down the list one last time and symlinks ~/.cover/Artist_Album.jpg -> ~/Music/.../artist/album/cover.jpg

What's the benefit

Now you have a nice neat folder under ~/.covers where you can store and manage ALL of your album art. Sanely named symlinks are placed in your music directory itself and you can quickly and easily manage and remove these files too.

The script does not duplicate effort. If you've got a valid cover at ~/.covers/Artist_Album.jpg already, it will be used. This means the script will get faster every time it's run as it will only process new music.

Try it

  wget -O ./coverart http://pbrisbin.com/bin/coverart
  chmod +x ./coverart
  sudo mv ./coverart /usr/bin

Enjoy.

Also, if you use and like this script, check out its conky companion which leverages all this work to display the covers in conky as they play in mpd.

Update

Please note that if you grab the most recent version of this script, it no longer uses the symlinking approach. The reason for this is that I started sharing my music directory out to my HTPC.

I noticed that xbmc would use ./folder.jpg if found, but since it was a symlink in my case, permissions prevented its use. If I updated the script to actually download the image to the appropriate spot, all is well.

All is not lost with this approach; You can still quickly manage your covers with a quick find ./ -name 'folder.jpg', and duplicate work is avoided by only processing album directories that are missing a file of that name.

Comments





pbrisbin dot com 2010