Importing Amarok statistics into Clementine

Recently, I switched from Amarok to Clementine for my daily music needs. Clementine is basically a port of the old Amarok 1.4 to Qt4 with some fancy features added. However, my old Amarok database is full of playcounts, scores and ratings for my music, so I wrote this little shell script to import it into Clementine’s SQLite database:  https://github.com/saschpe/amarok2clementine

It updates (i.e. overwrites) both scores and ratings and adds your old (Amarok) playcounts to the playcounts in Clementine. Note that it is not particularly fast as it uses neither MySQL’s nor SQLite’s C/C++ library interface but the respective command line tools instead. In case anything goes wrong, you will find a backup of your Clementine database in /tmp/clementine.db.backup. Enjoy!

About these ads

12 thoughts on “Importing Amarok statistics into Clementine

  1. Great! That is exactly what I needed. For now I have only errors, but I’ll try to pass them. My my.cfg in in /.kde/share/apps/amarok not “kde4: for some reasons.
    And I didn’t get, should I put my amarok2 database to external mysql?

  2. Done! Perfect!
    Errors fixed by:
    sudo /etc/init.d/apparmor teardown
    I guess there are better way to make mysqld work, but…

  3. this does not work for me. I installed “mysql-server” and did what my pre-poster suggested but i get the following output. The path for the config is correct. Hope you can help. Thx – Felix

    sh ./amarok2clementine.sh
    Could not open required defaults file: /home/felix/.kde/share/apps/amarok/my.cnf
    Fatal error in defaults handling. Program aborted
    110531 22:30:59 [Warning] Can't create test file /home/felix/.kde/share/apps/amarok/mysqle/felix-laptop.lower-test
    110531 22:30:59 [Warning] Can't create test file /home/felix/.kde/share/apps/amarok/mysqle/felix-laptop.lower-test
    110531 22:30:59 [Note] Plugin 'FEDERATED' is disabled.
    110531 22:30:59 InnoDB: Initializing buffer pool, size = 8.0M
    110531 22:30:59 InnoDB: Completed initialization of buffer pool
    110531 22:30:59 InnoDB: Operating system error number 13 in a file operation.
    InnoDB: The error means mysqld does not have the access rights to
    InnoDB: the directory.
    InnoDB: File name ./ibdata1
    InnoDB: File operation call: 'open'.
    InnoDB: Cannot continue operation.
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/home/felix/.kde/share/apps/amarok/sock' (2)
    cat: /tmp/amarok-dump.pid: No such file or directory
    kill: 37: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
    kill -l [exitstatus]
    rm: cannot remove `/tmp/amarok-dump.pid': No such file or directory
    cat: /tmp/amarok-artist_track_album_rating_score_playcount.csv: No such file or directory
    rm: cannot remove `/tmp/amarok-artist_track_album_rating_score_playcount.csv': No such file or directory
    kill: 1: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
    kill -l [exitstatus]

  4. This may be an issue of different Amarok versions. What distro do you use and how’s your Amarok configured? Check it’s settings dialog for any special db setup. It’s working at least on openSUSE.

  5. Due to the move from KDE3 to KDE4, several distros named KDE4’s config folder ~./kde4, as ~/.kde was already in use. After KDE3 phased out, it was changed back. Distros still differ slightly, though.

  6. I use Ubuntu and my amarok (1.4.10 using KDE 3.5.10) uses SQLITE.
    The my.cnf file in the config folder (.kde/share/…) is empty.
    The permissions of the file are fine and there is no problem opening it with gedit.

    On my very first attempt I tried running the script without the “mysql-server” package which leads to mysqld & mysql: not found. I should not need this though because my DB isn’t mysql.

    Felix

  7. Ok, you’re using Amarok-1.4, which is quite old. This script only works for Amarok-2.x. But the database layout of Clementine strongly resembles that of Amarok-1.4, so you should be able to adapt the script.

  8. Now here is how to “import” the ratings from amarok 1.4:

    -Filter your Amarok collection so only the songs rated 5* are shown.
    -Drag and drop them into clementine (create a playlist), select all of them and rate all of them 5*
    -Do the same for all other ratings.

    This is so simple it is should not need mentioning – However I didn’t think of it at first so I wrote this for everyone else as dumb as me :)

    Felix

  9. […] I haven't found anything to import my Amarok 1.4 database into Clementine. I've been trying to get this script to work but no success yet. According to the blog comments, 1.4 is not supported and somebody with […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s