
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.
Please fetch the latest version from the downloads page. Refer to the changelog for a list of changes in the release.
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 dev-python/lxml
On Debian, Ubuntu and distributions derived thereof use the following command:
aptitude install python-sqlalchemy python-imaging python-lxml
As last resort, all these packages are also available on the PyPI and can therefore be installed with pip:
pip install PIL SQLAlchemy lxml
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.
Create a Desktop Entry for each exported cover. This desktop entry sets the exported cover as directory icon.
By default, the script only outputs error messages, according to the old unix motto: “No news is good news”. With this option, the script is a bit more chatty.
Please report issues, proposals or enhancements to the issue tracker.
If report an issue, please be sure to attach the complete debugging output of the script. Run the script with the following options:
export_amarok_covers --debug --log-sql --logfile export_amarok_covers.log
Now attach the resulting export_amarok_covers.log to the issue.
This script is develop on BitBucket. The complete source code is available in a Mercurial repository:
hg clone https://lunar@bitbucket.org/lunar/amarok_covers
Feel free to fork the repository and send pull requests or patches.
This program is free software, you can redistribute and/or modify it under the terms of the WTFPL 2.
Glossary