#42 Import existing cover art in your music directories

Iron City

First off, just wanted to thank the people who have
made GJukebox possible, I love it! Here's hoping I can
contribute my small part with this Perl script.

I already had a fair amount of saved album cover art in
the form of high quality jpegs of the front cover
residing in each album directory. I wanted to use my
existing pictures rather than go through the process of
using getpictures.pl or manually importing the cover
art through the web interface.

The script essentially automates the web interface
manual import function. It finds all album with a
"null" in the cover art field of the Programs table. It
then searches through the directory structure looking
for a matching album artist and, below that directory,
a directory with the album name. Then it looks for
image files in that directory. Once an image file is
found it makes the same call to the getpictures.pl that
the php page does when you manaully import cover art.

My music directory structure is sorted like this
/mnt/win/Music/<Genre>/<Artist>/<Album name>/ so I'm
not sure how well this would work with another
directory structure.

The script takes a few arguments which can be seen with
the --help argument. The basic call to import all cover
art would be "perl importcoverart.pl -d <path to top
level of music directory>". For example "perl
importcoverart.pl -d /mnt/win/Music". The best thing to
do would be to run it with the test parameter first
like "perl importcoverart.pl -d /mnt/win/Music --test"
which will show the output of what the script with do
without actually importing the coverart. You can also
import one album at a time if you know the album id by
using the --id={number} argument.

I should note I'm not a Perl programmer... Use at your
own risk! Hope this helps someone. :)


  • Iron City
    Iron City