PDA

View Full Version : Integrating cover art from Amarok



Bill Moseley
2007-03-17, 16:45
I sometimes use Amarok for playing music. It makes it very easy to
load cover art for my collection.

Anyone know of a way to extract the cover art from Amarok for use with
Slimserver?

Don't want to reinvent the wheel in case anyone is already doing this.


--
Bill Moseley
moseley (AT) hank (DOT) org

srasher
2007-03-17, 17:24
I did exactly this. I used an Amarok script add-on called "CopyCover", available from

http://www.kde-apps.org/content/show.php?content=22517

It is intended to copy the cover of the currently played song to the song's physical dir location, but there is also an "offline" version of the script which I modified to copy all covers in Amarok's album cache to one directory, using names like

<Artist> - <Album>.jpg

This folder is then used as a common album art folder in SlimServer's settings (I personally prefer this solution over the folder.jpg approach because you can more easily do things on ALL the covers, e.g. reorganize them or run batch image processing on all of them). It took about one hour of manual post-processing as some of the artist/album names contain strange characters and stuff like that but now it works like a charm.

Just to prevent avoidable confusion/damage to your music and artwork files: read the README file of the copycover script package before executing anything. There is a command line switch for only pretending to do copy the covers in order to show what the script WOULD do. You might find this useful... I also slightly modified the script to first copy everything to a "working directory" so that nothing was done/changed in the server files themselves before I was sure everything was sorted out correctly.

Hope this gives any help to your plans. Cheers,
Sebastian

bklaas
2007-03-19, 07:41
Sebastian-

would you be willing to post your modified script here? If not, could you email it to the address on my profile?

I've wanted to do this for years...Amarok's cover manager is excellent, and I'd love to be able to offload the art.

cheers,
#!/ben

Bill Moseley
2007-03-21, 20:24
On Mon, Mar 19, 2007 at 07:41:45AM -0700, bklaas wrote:
>
> Sebastian-
>
> would you be willing to post your modified script here? If not, could
> you email it to the address on my profile?

Sure, soon as I can get the md5 generation to match up what Amarok is
doing.... ;)

--
Bill Moseley
moseley (AT) hank (DOT) org

Bill Moseley
2007-03-21, 20:55
On Wed, Mar 21, 2007 at 08:24:27PM -0700, Bill Moseley wrote:
> On Mon, Mar 19, 2007 at 07:41:45AM -0700, bklaas wrote:
> >
> > Sebastian-
> >
> > would you be willing to post your modified script here? If not, could
> > you email it to the address on my profile?
>
> Sure, soon as I can get the md5 generation to match up what Amarok is
> doing.... ;)

Oops -- I'm not Sebastian.

What do you want the script to do?

I just wrote an (unrelated) script that moved all my music files into
directories <artist>/<album> based on the id3 or meta tags.

So, my script will just scan the music folder and then try and find
the album art by creating the md5 hash that Amarok uses to store the
image file -- then look for the image and hard link it into the
album's directory.

Not sure what to do when a directory contains multiple tracks where the
artist/album don't all match. I believe there should only be one
image file per album folder.

amarok=>
select distinct
artist.name,
album.name,
md5(lower( artist.name || album.name ))
from
tags
join artist on tags.artist = artist.id
join album on tags.album = album.id
where
tags.album = 795;
name | name | md5
----------------------------+-------------+----------------------------------
Bob Marley And The Wailers | Natty Dread | 93273eeff74ade8dbc2cef6293775280
(1 row)

And the associated album art:


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




--
Bill Moseley
moseley (AT) hank (DOT) org

bklaas
2007-03-22, 07:59
hi Bill-

I ran your SQL query without the 'where tags.album = <albumid>' clause and all records return the same md5sum. Any ideas there?

I have a script that I used to use for a very, very similar task that could be reworked for this purpose. If you want to pool resources, I'm game.

cheers,
#!/ben

srasher
2007-03-22, 15:41
Hi Ben,

sorry for the delayed answer, I had some web access troubles for the last days. Of course, you can have my modification, it (the modification) is of rather ridiculous complexity, as I only use the original offline script to gather all the files in a temp directory with as I wrote

<Artist> - <Album>.jpg

as filenames. To be honest, I own roundabout 1000 CDs but there are only about 25 various artist ones beneath them, so I did not start to struggle with this well discussed issue too long but just did some manual copying and adjusting for these afterwards. As well as for albums/artists containing "/" in the name, so for example for "AC/DC - For those about to rock" the file is called

"DC - For those about to rock.jpg"

and resides in the subfolder

"AC"

This works pretty well with SlimServer when handling all artwork files in a common folder.

I have attached the original script and the modified one so you can see how little modification there is. For the moment I am pretty happy but as I love Amarok as an in-front-of-the-PC-solution and in parallel I am damn happy with my Squeezebox/Nokia 770 combination (thanks so much for the skin by the way!), I am always interested in anything you might do to the Amarok-Squeezebox-"integration" and also willing to join efforts on scripting in case you need some help or some additional opinion!

Hope this is of any help to you!

Cheers,
Sebastian

Bill Moseley
2007-03-24, 16:12
On Thu, Mar 22, 2007 at 07:59:38AM -0700, bklaas wrote:
> hi Bill-
>
> I ran your SQL query without the 'where tags.album = <albumid>' clause
> and all records return the same md5sum. Any ideas there?

Same md5 hash? With Postgresql? Shouldn't be the case.


> I have a script that I used to use for a very, very similar task that
> could be reworked for this purpose. If you want to pool resources, I'm
> game.

Ya, just have to get it back into my schedule. ;) I have not decided
what I want the script to do.

Since Amarok uses the id3 tags to generate artist and album (and thus
the md5 has) I suppose it makes sense to scan all directories and
generate sums for all audio files (ignoring duplicates) then look for
the cover art in the amarok directory. Copy the image to the
directory and also create a thumbmail at the same time.

What I'm not clear about is what to do if a given directory has more
than one music file that don't agree on Artist/Title tags. IIRC,
Slimserver expects to only fine one art file per directory.

--
Bill Moseley
moseley (AT) hank (DOT) org

srasher
2007-03-24, 16:35
Hi Bill,

maybe this doesn't catch the point for you, but just as an alternative train of thought:

You don't necessarily have to use artwork by putting an album.jpg or whatever into each album's folder. You can also use one common folder where all the artwork files are stored together using a naming scheme that identifies them uniquely. With this you don't get into any hassle when concurrent Album/Artist information is stored in the same album folder.

The necessary information for this is anyway already there as you read the Album/Artist tags. Of course, I admit there might be other drawbacks with this method, at least for me (as I wrote: ~1000 albums and very few "various artists" ones) this works pretty well...

Cheers,
Sebastian

verbatone
2007-05-17, 16:16
There might be an easier way to do this. I had a hard time following this thread, but there's a Rockbox script which takes the image and puts it into the directory where the media is located. I haven't used it, but if it does what it says it does, it would work. Look here for info:

http://amarok.kde.org/wiki/Scripts

I may play around with it and see if it works. Probably later have to rename all the files to folder.jpg or something like that

bklaas
2007-05-17, 16:26
my guess that the rockbox script will need some tweaking because I bet it resizes the images. but, definitely looks like it's got promise...

keep the thread posted with what you find. You have at least one forum reader that's interested ;)

#!/ben

verbatone
2007-05-17, 17:37
You're right, it does do some resizing, looking through the scripts again, I found another called CopyCover which looks like it will do everything very efficiently. It has an "offline" mode so you don't have to listen to every artist to get it to move the image file, then it also has a file renamer, which is great too. I'm going to check it out when I get home and see how it runs. The offline mode isn't an Amarok script, but rather a command line python script that runs while Amarok is running. Requires Python 2.3 or better.

http://www.kde-apps.org/content/show.php?content=22517

verbatone
2007-05-23, 11:25
I re-read through this thread and people make mention of using CopyCover. I used it two nights ago and it ran like a charm, the offline version at least. I didn't install the actual script. The main problem I see is that it won't overwrite files, at least it says it doesn't, maybe there's an overwrite command line option. So once the cover images are in their respective file folder, you'd have to delete them before running the CopyCover script again to get it to update the files.

Of course Amaroks cover fetcher couldn't get images for all of my music, so I'm stuck right now with some empty images as well as some "partially" correct images. If I want to update again, I'll have to check out the overwrite issue.

Pale Blue Ego
2007-05-24, 00:16
Of course Amaroks cover fetcher couldn't get images for all of my music, so I'm stuck right now with some empty images as well as some "partially" correct images.

Google's image search works pretty well for finding album art. It's very fast and usually finds multiple resolutions.

sebp
2007-05-28, 14:48
I wrote my own Perl version of the offline copycover script, that does feature everything the original copycover-offline.py script did, plus :
- customizeable cover name
- option to overwrite existing cover/directory entries
- support for samplers ("Various Artists")
- partial scan of collection

You may want to give it a try :
http://www.le-seb.org/dotclear/index.php/2007/02/15/83-mycopycoverpl-110

Seb

verbatone
2007-05-30, 11:06
Google's image search works pretty well for finding album art. It's very fast and usually finds multiple resolutions.

I also found an interesting way of getting images off the internet. It's manual, but better than saving the file. If you right click and select "Copy Image Location," you can paste that URL into the "set custom cover" option in the cover manager. It will download the image directly.

Will have to try the Google image search for my missing covers.

verbatone
2007-06-07, 16:33
Man, I can't get this stupid system to work!!! Ok, so updated all my covers, getting files from Google images and such so that I basically had all the correct covers that I could have.

Around the same time, I went through and updated some (a lot) of my tags cause I didn't like how they were displayed in SS.

The consequence is that now the md5 that Amarok used for its cover image file name no longer match the md5 generated using the new tags (in copycover). copycover and copycoverpl match the image to the directory through md5 generation.

So is there a way to force an update of Amaroks cover image md5 filenames? As well, is there any systematic way to rename he md5 filenames to the new tag's md5 generation. Or am I stuck and I have to do a manual dump of the database and start again?

Seem silly that upon updating music tags, there's no connection between the md5 and tags anymore. Where does Amarok store the "connection" between the music and the cover image? In collection.db? And if so, is there a way I can use that to rebuild the connection between md5 and the tags? Thanks!