Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Does xmms2 have bindings either a Python API or a command line tool to find the album cover art of an MP3?

Related to xmms2 notification with album art under Awesome.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

If you want a generic way to do that, that involves a single command or function, sorry this isn't it.

Assuming you know the location of the of the covers, for example ~/.xmms2/clients/generic/art/ you just need the name of the file corresponding with a particular album and artist.

According to the wiki the name of the image file is calculated using the md5 checksum of the "$artist-$album" all in lowercase, resulting in something like 186bdc073dcbab197caa9000e441a740-thumbnail.jpg for the album "Some Album" from artist "Some Artist". You can calculate this with a few shell commands.

COVER=$(echo "Some Artist-Some Album" | tr [A-Z] [a-z] | md5sum)
COVER="${COVER%  -*}-thumbnail.jpg"

You can replace "Some Artist-Some Album" with "$artist-$album" given the values you need are actually stored on those variables.

Using ${COVER% -*} because md5sum adds a " -" at the end of the generated string, maybe there is a better way to fix that.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.