
Amarok has the ability to automatically fetch and display cover images for albums contained in its collection. However, these covers are stored in Amarok’s data directory, and not inside the collection directory. This script exports all these covers into the collection directory. Moreover, it can create a Desktop Entry for covers, which is used by compatible file managers (e.g. Dolphin from KDE 4) to display the cover as directory icon.
export_amarok_covers as described on this page is written for Amarok 2. Older versions for Amarok 1.x have been removed from this site, as Amarok 1.x is not supported anymore.
You need Python (at least version 2.6) installed and working. Extract the archive, change into the directory and run:
python setup.py install
This will install the script in /usr/bin/. The prefix can be changed using the --prefix option. The following command will install the script in ${HOME}/bin/:
python setup.py install --prefix ${HOME}
To run the script, the following external modules are required:
As these packages are very common, they will most likely be available in the package repositories of your distribution. On Gentoo you can use the following command to install them:
emerge dev-python/python-sqlalchemy dev-python/imaging
On Debian, Ubuntu and distributions derived thereof use the following command:
aptitude install python-sqlalchemy python-imaging
As last resort, all these packages are also available on the PyPI and can therefore be installed with easy_install:
easy_install PIL SQLAlchemy
Note
As of now, the script does not work with Amarok’s embedded MySQL database, but only, if Amarok is configured to use an external database. Support for internal database is not difficult to implement, but no one wanted it yet.
To get your covers exported, just run:
export_amarok_covers
That’s it. The script then reads the Amarok configuration, connects to the Amarok database and exports all covers, which are not contained in the collection directory. Each album cover will be exported to all directories, which contain files of the corresponding album, so be sure, that your collection is properly sorted!
Additionally you can enable the creation of desktop entries to use the exported covers as directory icons. To do this, use the -e option:
export_amarok_covers -e
Of course, this only works with compatible file managers, but this includes all file managers of modern desktop environments like Gnome or KDE.
In the following there is a detailed description of the mentioned command line options. Some rather unimportant options are not description here, use the --help option to get a complete overview about all supported options.
Specifies the name of the exported cover file, under which is can be found in the album directory. The default is cover.png.
If you specify an extension, the cover is converted to the image format denoted by the extension (e.g. .jpg for JPEG format, or .png for PNG format). If you omit the extension, it is guessed from the image format of the cover. In this case, the cover is simply copied to avoid potential quality loss due to repeated compression.
This program is free software, you can redistribute and/or modify it under the terms of the WTFPL 2.
Glossary