Amarok StatSyncing GSoC: week 12 - heat up your Last.fm accountz

Matěj Laitl · August 11, 2012 · 2 min read

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 Last.fm 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 Last.fm 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 Last.fm tracks of your Last.fm Library; you have to have Last.fm plugin enabled and configured for this to work. Last.fm can match tracks by their artist, album and title.
  • Implemented reading of Last.fm metadata - it can provide play count and tags, and we use a trick to store rating using tags.
  • Implemented updating of Last.fm metadata - it can update tags and, with our little trick, even rating. See screenshot below.


My Last.fm tags look like this now. :-)

Problems I've faced:
  • First & last play dates sadly aren't provided by Last.fm, although they have the data. Fortunately the framework is flexible enough to gracefully cope with them missing. But I'll try to convince Last.fm 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 Last.fm 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 Last.fm - 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