Looking up cover art in database

Bill Moseley moseley at hank.org
Sun Mar 18 19:34:35 UTC 2007


I'm using 1.4.4 with Postgresql.

Is the md5sum used for the cover art file name stored in the
database?  It's not calculated every time, is it?

I see an images table but it's empty.

    amarok=> select * from images;
     path | deviceid | artist | album 
    ------+----------+--------+-------
    (0 rows)


Poking Google....  I find this:

    http://milianw.de/misc/copycover-offline.py

And it does:

    md5sum = md5.new(artist_tuple[1].lower() + album.lower()).hexdigest()
    album_cover = os.path.join(cover_dir, md5sum)

where artist_tuple[1] is the artist name.

So if I do this in Perl:

$ perl -MDigest::MD5 -le 'print Digest::MD5::md5_hex(lc "Bob Marley & The WailersNatty Dread")'
bc9732fd602386a091c5f1231b1828fa

or from the shell:

$ echo -n "bob marley & the wailersnatty dread" | md5sum
bc9732fd602386a091c5f1231b1828fa  -


that md5sum doesn't match the cover art for that album.

.kde/share/apps/amarok/albumcovers/large/93273eeff74ade8dbc2cef6293775280

So I must be using the wrong strings for the md5sum.

I have way fewer downloaded cover images than albums, so it would be
best to look up the albums by the md5sum instead of looping through
all the artists and albums creating the md5sum and stat'ing for them.

But, if the md5sum isn't in the database then I'll have to do it that
way.  I'm just not clear how to correctly generate the sum.




-- 
Bill Moseley
moseley at hank.org




More information about the Amarok mailing list