Exporting album covers

Mark Fraser mfraz74+kde at gmail.com
Tue Mar 26 07:37:03 UTC 2013


On Tuesday 26 Mar 2013 08:06:29 Maxime. Haselbauer wrote:

> 
> 2013/3/25 Scott Yanke <scott.yanke at charter.net>
> 
> >  One of the side effects of having the many different devices we can play
> > 
> > music on is that we often want to see cover images to go with the sound.
> > It's easy enough to copy our music files from Amarok to a tablet or MP3
> > player.  The hard part has been getting the covers to go along for the
> > ride.  In Amarok, which is my core music repository, the covers are all
> > uniquely named in the .kde/share/apps/amarok/albumcovers/large directory.
> > That works great for Amarok, but not so well for one of my tablets.
> > 
> > To make things easier for those who want the same cover image Amarok uses
> > to also be on their tablet, I've put together a quick little python script
> > that gets the unique image name, and creates a copy command to put that
> > image in the directory where the albums tracks are (presumably).  It isn't
> > pretty, and it isn't perfect, but it does go through albums quickly and
> > creates the proper output (mostly).  It's simple enough that anyone can
> > fine-tune it for their own needs.
> > 
> > The python script is less than 60 lines long.  Given that I am using the
> > embedded mysql with Amarok, it starts mysql as a separate task to do the
> > SQL against, then shuts it down when finished.  That was easier than
> > trying
> > to learn embedded mysql.  The script simply writes the output to the
> > terminal.  It's easy enough to redirect to a file for verification and
> > editing.
> > 
> > In the script, replace "scott" with whatever your login name is.  My music
> > files are in a directory structure with a base of /shared/music.  The
> > final
> > print command corrects for the name received from Amarok so the copy of
> > the
> > cover image will go into the correct album location within that base.  The
> > imghdr module is used to obtain the image type, like jpeg or png.  The
> > script corrects the result from jpeg to jpg, although it probably doesn't
> > have to.  Because the result of the select on the directories table starts
> > with "./", a temporary variable is used to help trim that off the front of
> > the path.
> > 
> > Note that this script does nothing with images that are not in the users
> > amarok/albumcovers directory.  It also does not change anything within the
> > Amarok database - it is a read-only set of statements to figure out what
> > the image is called.
> > 
> > You are welcome to use this script however you want.  It has helped me
> > with getting my album covers out of Amarok and onto my tablets.  If
> > someone
> > wanted to burn a CD of their music, the images might help them also.  Run
> > time on this is less than 20 seconds for 1,600 albums.  Personally I wish
> > Cover Manager had an export tool that did this.
> > 
> > <Script>

> If you are using mp3 files, I think it is also possible to save the cover
> picture inside the mp3 itself, so that it always remains embeded.
> I think there is an option like that in amarok configuration. (Or maybe I
> dreamt ^^^) When I copy mp3 files to my N900 at least, all covers come
> along with the mp3s.

Trouble is if an album has say 10 tracks in it, then that is 10 copies of that 
album cover you have. Which is why I prefer to have it as a separate file in 
the folder. As for the script, it may be worth you looking at CopyToCover2 
which already does what your script does plus you can configure what you want 
the image to be named.



More information about the Amarok mailing list