Saturday, 11 August 2012

Amarok StatSyncing GSoC: week 12 - heat up your accountz

Hi, apart from packaging Amarok 2.6 (look forward to it!) I've also made significant progress on my GSoC project about statistics synchronization in Amarok this week. In short, 2-way synchronization of your precious metadata with works now.

Notice that rating and labels are already synchronized.
This was the last big milestone of my project and I'm happy to have it completed just before GSoC's suggested pencils-down date. I must say that implementing all the stuff was easier than expected, but that's probably because of the solid foundations of the framework that have been laid earlier. :-)

Compare with screenshots from earlier posts.
What I've done this week:
  • Restructured internal code of StatSyncing::Controller to be even cleaner with regards to maintaining synchronizable collections.
  • Polished the UI of the Choose Providers dialog. It is much cleaner now and will make the KDE Usability team happy. See screenshot above.
  • Changed track matching to be case-insensitive. It would be a pity not to match 2 tracks just because the other one is not properly capitalized.
  • Implemented logic to synchronize labels across collections. For each track, you can tick which collections will be the sources of labels. Resulting labels are then the union of the checked ones.
  • Implemented matching with tracks of your Library; you have to have plugin enabled and configured for this to work. can match tracks by their artist, album and title.
  • Implemented reading of metadata - it can provide play count and tags, and we use a trick to store rating using tags.
  • Implemented updating of metadata - it can update tags and, with our little trick, even rating. See screenshot below.

My tags look like this now. :-)
Problems I've faced:
  • First & last play dates sadly aren't provided by, although they have the data. Fortunately the framework is flexible enough to gracefully cope with them missing. But I'll try to convince staff to include them in their web API.
  • liblastfm has a bug in its Track::removeTag method which breaks tag removal. I've fixed it, but the bug will hit you unless you use my liblastfm branch or until liblastfm incorporates the pull request and releases it.
The lasts bits left to do:
  • Buttons for mass-resolution of label conflicts in the Matched Tracks dialog.
  • Configuration option to exclude some labels from synchronization.
  • Option in the plugin to opt-out from using the fancy rating tags.
  • Better error reporting.
  • Further polishing of the Matched Tracks dialog as suggested by the KDE Usability team.
  • Scrobbling tracks played on iPods to - all support code is ready, I only need to devise an algorithm for guessing scrobble times (we only have last played time and play count).
You can test my work by pulling and building the gsoc branch of my Amarok git repository clone. It works really well now! I also publish weekly diffs with more technical details on KDE's review board which may be a more convenient way to review my code and to comment on it: week 1 week 2 week 3 week 4 (week 5 done in →) week 6 week 7 (master bugfix) week 8 (master bugfix) week 9 weeks 10 & 11 week 12


  1. Wow, really awesome work. Mega props to you. Any idea if/when we'll be seeing this in an official release of Amarok?

  2. Glad you like it. It will be definitely included in Amarok 2.7, but its
    release won't happen any time soon given that we're just releasing 2.6.
    End of 2012/beginning of 2013 is and estimate.

    If you're impatient, compiling the from git shoudn't be really hard, we are ready on #amarok to help users compiling. Currently it's only in my clone, but it should be merged to Amarok git master as soon as it is ready (weeks).

  3. This is great, can this new feature handle a database of 100,000 plays in

  4. Mine has over 150,000 and it handles it just fine. The performance depends more on the number of unique artists you have in your library (mine has over 1000) and on the number of tagged track you have (I have thousands). With all these numbers, synchrinization takes a couple of minutes here, which I consider fine, given you get a nice progress bar and the window is non-modal.