Amarok StatSyncing GSoC: week 1

Matěj Laitl · May 25, 2012 · 2 min read

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