Saturday, 26 May 2012

Amarok StatSyncing GSoC: week 1

Hi, I'm Matěj Laitl and this summer I've been accepted to GSoC for Amarok to work on statistics synchronization between various collections and scrobbling services such as Here comes my first weekly report, enjoy reading it. :-) In short, I've worked on a background worker that will associate same tracks from various sources with each other.
Obligatory screenshot. Current visible effects of activating that action are none. :-)
What I've done this week:
  • Designed core (abstract) classes that will facilitate statistics synchronization for both collection and online service tracks: TrackDelegate and TrackDelegateProvider.
  • Implemented these interfaces for tracks from Amarok collections (e.g. Local Collection, iPod and USB Mass storage ones...).
  • Implemented controller, singleton class that is entry point to synchronization functionality in Amarok.
  • Implemented MatchTracksJob, a job that runs in background and matches tracks from multiple providers into track tuples with same meta-data.
Problems I've faced:
  • Encapsulating asynchronous API of some Amarok classes (QueryMaker) to be synchronous and thread-aware was a bit tricky.
  • I had hard time implementing lessThan() comparison function that needs third argument for Qt's qSort(). Function template did the job, but that made MatchTracksJob non-reentrant. :-(
  • It isn't clear what meta-data should participate in track matching. Some sources provide few of them ( provides just artist, album, title; sometimes less) while Local Collection and friends can provide much more. I've made MatchTrackJob generic with regards to matched fields with artist, album, title being mandatory and composer, year, track & disc number being optional.
What's next:
  • We've ongoing discussion with Bart Cerneels whether TrackDelegate is redundant or not. I've made sure to code in a way that it can be replaced in future without hassle.
  • The GUI to show matched tracks, providers etc.
You can test my work by pulling and building gsoc branch of my Amarok git repository clone, but beware that it currently contains an unrelated change (pending to be merged) that will make your Amarok database temporarily incompatible with current Amarok git master. Update: the change has been merged! 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


  1. Progress is good but your fonts are really ugly man! C'mon pick a good font that suits the ui.

    1. Why don't you like my fonts? :-) Show me yours!

    2. Of course it is your decision :)But they are also big. Maybe smaller ones fit the menus better. Or these are easy to see for you.

      I use Liberation Sans:

    3. Droid Sans 8px, force 96DPI, slight RGB hinting here, works like a charm for me. That or Deja Vu with the very same settings.

      Closer to the topic, did you design and write all that code in one week? That's very productive in my book. Keep up the effective work!

    4. > Closer to the topic, did you design and write all that code in one week?

      Thanks. :-) I wrote it in one week, but I've been toying with the design for months in my mind. (even though it changed slightly when put into code) Currently I'm working on the GUI, so stay tuned, I'm pleasantly surprised how convenient Qt's Model/View classes are.

    5. >Currently I'm working on the GUI, so stay tuned, I'm pleasantly surprised how convenient Qt's Model/View classes are.

      That means you have some experience in UI programming with other toolkits, don't you? :) Qt is indeed convenient, my only gripe with it being Trolltech / Nokia's ignorance of STL, boost and templates / advanced C++ features because of their "api instability". This is one caveat you have to get used to if you're coming from gtkmm or wx or some other toolkits / libraries with more extensive c++.