The ball has been dropped by me - dropped hard - during the past several weeks. First, I was stumped for a week and a half by the glib+qt fiasco, then my development machine’s hard drive shuffled off the mortal coil. Replacing it took a solid week, and when it finally arrived I installed Gentoo. Two days later, the finally install completes as I’m frantically throwing my life’s possessions into a car:
Fast forward through seven hours of me hurtling down the interstate at not-so-safe velocities, and here I am, pardoning my recent idleness as my flight to Paris boards at gate D32. Not accomplishing much over the past several weeks suddenly doesn’t seem so bad: I’m going to Europe! There is a week long hack-a-thon at Akademy; I’ll catch up then.
A bientôt!
I’ve been slacking on the update reports over the past two weeks, because I’m holding out for the exciting post where I say “MP3tunes AutoSync is working! Huzzah!” Sadly, this report isn’t that one.
For the past week I’ve been banging my head against the wall of glib, QtEventLoop, and QThreads. I have quite a headache to say the least, but yesterday thanks to my mentor and Ian, both Amarok developers, my head actually broke through that wall. Literally. GLIB, and Qt are kowtowing at my feet swearing oaths of fealty. They have promised to work together and let me get back to doing fun things, like code new features.
Some non-Summer-of-Code related business popped up over the weekend, to take care of which required a slight road-trip. As such, I haven’t had much time to work on my project, however I’m heading back home today and I plan to get the code I have chilling in my local branch pushed to the main subversion repository.
Surprisingly, bulleted lists seem to be the most concise means to list progress [/sarcasm]
While looking at my last couple reports about harmony, I realized that the information is somewhat dry. I think this is because harmony is a highly technical, behind the scenes feature, and, also, often it is difficult to inject excitement into mundane programming updates. The humdrum is slightly symbolic of harmony. You will enable it once and forget about it as it silently keeps your music collection synced.
Related posts: GSoC Report Week 5: Harmonizing Amarok, One small step for Amarok…
Total Commits: 106 Weekly Commits: 26
I usually aim to post these reports on Monday, but I’m usually wrapping up a final commit or two on Monday night so I wait till Tuesday to post the report. Well now it’s 3:30 on Wednesday morning and I’m just starting. My last commit for “this week” was, oh, about 30 seconds ago.
During the last 7 days I:
As usual you can see a list of my most recent commits via my fisheye page.
What the heck is this Harmony nonsense?
Harmony, itself, is a subset of libmp3tunes that provides an api for receiving event notifications from the MP3tunes servers. Essentially, what it boils down to is harmony enables the MP3tunes servers to notify Amarok when a user’s Locker has been changed. This will allow Amarok to assess the changes and perform an appropriate action (e.g., download a new track).
Suppose Jenni buys a song from eClassical and has it loaded directly to her locker. When this happens her Amarok will receive a notification: “Hey Amarok, Jenni just had a track added to her locker.” At which point Amarok will seamlessly download the track to Jenni’s local collection.
Pretty cool right? Sure is, there’s just one caveat: it’s not working yet. Getting harmony to play nice with Amarok was a challenge that took a couple days, but as of this morning harmony is running in Amarok.
By this time next week I plan to have harmony fully integrated with Amarok, so the above scenario can actually take place. Even though the feature freeze that was announced for Amarok 2.0 technically doesn’t include me, I will still be taking some time to polish all the work I’ve done since May.
Total Commits: 84 Weekly Commits: 36
Starting these posts with “It was another busy week..” is starting to get boring; I’ll cook up something more exciting for next week.
In case you missed it, in the past seven days history has been made. I’ll let that stand in as the bulk of my weekly report, but a few worthwhile things have occurred since then that deserve a mention.
Remote Track Upload - You can now sideload tracks to your MP3tunes collection from remote sources in Amarok. What the heck is sideload and what remote sources you ask? Sideload is a feature of the MP3tunes API that allows for server-to-server transfers. This means you can give your Locker a URL to a track, and it will automatically be downloaded into your Locker. Currently Amarok sports three services with remote collections that are sideloadable to MP3tunes: Ampache, Magnatune, and Jamendo. This method of transferring is generally very fast, because the transfer bypasses your slow internet connection.
Upload Progress Bar - When you upload (or sideload) tracks to MP3tunes there is now a simple status bar to let you know how far along in the process you are.
Non-Supported Track Filtering - This one is simple: If you try and upload a file-type that MP3tunes doesn’t support, Amarok will tell you and stop that track from being transferred.
The first one will be simple, in fact I plan to code it up after writing this report. These second and third tasks, however, signify that I’m moving into the last stage of the project. According to my original proposal I am ahead by a week, so I’ll be using this week as extra time to plan and get a jump-start on the synchronization framework.
I’m very excited to announce that the first Amarok->Cloud transfer has taken place. Just moments ago, for the first time ever (as far as I’m aware), a track was sent up into the Cloud from a desktop media player, escaping the local collection prison. This track shed the chains of limited accessibility, and is no longer doomed to obscurity, lost in an sql database in my home directory.
This lucky track happened to be Making Me Nervous by Brad Sucks available over at the great indie music label Magnatune.
Early this morning I committed the last bit of code that allows you to upload tracks to your MP3tunes Locker from Amarok. Amarok is the first client, besides the official client, to allow you to do such a thing. One of the great things about this feature is it’s seamless integration in the UI.
After a short upload I go check the MP3tunes Web Player

From this point I can listen to the track on my phone, on my squeezebox, or any other MP3tunes supported devices.
Of course there are some caveats, but I aim to fix these over the next several days:
Don’t start thinking that things are winding down; uploading and downloading are only one small part of the show. The end goal is fully automated bi-directional syncing between Amarok and MP3tunes with 100% support for the MP3tunes API.
What exactly does this entail?
And it all started today.
Total Commits: 51 Weekly Commits: 12
It was another productive week in #amarok with over 150 commits! In the 12 of those that were mine I managed to do several things.
Of course, implementing those items wasn’t as simple as it sounds, but the features are essential and basic.
The search box (filtering) could use some improvement as currently it only filters via the artist field, but that is a limitation of the MP3tunes API. When I say it
“only filters via the artist field” I mean that it only matches against artists, so searching for a particular track name will not work. To fully support the filtering feature the MP3tunes API would need to allow you to do something like get a list of artists based on a partial track name in a single request. That is just one example, and yes, I could workaround it by doing multiple queries, however that would slow the entire operation significantly. Users expect the search fields in Amarok to be snappy, not take ~5 seconds per. token they supply. It is certainly not a showstopper, and it functions well enough for now, but hopefully MP3tunes will be open to expanding their API later on down the rode. To be fair I have never come across a web API that supported that sort of complex searching. The Ampache service in Amarok suffers from the same lack of functionality.
Interjection: Major props to my GSoC mentor, Nikolaj, for attempting to explain various parts of Amarok’s innards to me, not only once, but the several times it took to get the concepts through my thick skull. Also, he’s helped me track down several childish mistakes I’ve made when I was at my wits end trying to locate them. I can’t thank him enough. Hands down he’s the best GSoC mentor.
With the addition of “Copy to Collection” Amarok has taken a large step towards being fully integrated with MP3tunes. Up till this week all you could do was browse and stream your MP3tunes Locker. That is fine and dandy, but you could do that from the MP3tunes web player, their mobile player, your PS3, or any other number of their supported devices. However, none of those options allow you to seamlessly download and organize your stored music into your local music collection at the click of a button.
There is one shortcoming that needs to be addressed at some point before I’m satisfied: there is no progress indicator of any kind when you download tracks. The only way to see if tracks are being downloaded after you press Go is to watch the destination directory for changes. Thankfully this affects all collections you can “copy to/from”, not just MP3tunes, so perhaps someone else will feel inclined to whip up a progress indicator. There’s no such thing as a free lunch.
I have one big goal this week:
By Monday next week, you will be able to do Copy tracks from your local collection, Ampache collection, and the Magnatune database, to your MP3tunes locker.

There is quite a bit of work to be done before this can happen, but I will spare you the gritty implementation details until next week after I’ve committed the code where my mouth is (?).
Of course my weekly predictions wouldn’t be complete without a task to fall back on if I happen to complete the aforementioned task in a Ballmer-Fueled rage. After upload is in place there is only one major item left: Syncing. I need to break “Syncing” into manageable actionables (quite a term, eh?) and then lay out some mid-level designs for the process. Later on during the week I will dedicate an entire post to this topic.
Total Commits: 35 Weekly Commits: 15
This was a busy week. I migrated the existing MP3tunes service in Amarok 2 from making REST calls and parsing XML manually to use libmp3tunes. I created an object oriented encapsulation framework in C++ for libmp3tunes, which is written entirely in c. This means instead of mucking about crafting http queries and worrying about parsing data from XML one can manipulate the Locker in an OO fasion. Here’s a little snippet of how libmp3tunes saves work.
Without libmp3tunes if you wanted to fetch a list of artists this is what it would look like:
With libmp3tunes it looks like this:
Both of those code samples produce this:

Notice that instead of looping through XML and ripping out data, I was able to call getter methods to retrieve the same data. Of course the XML parsing has only been moved to libmp3tunes, but by hiding the MP3tunes API implementation from Amarok it creates more maintainable code.
If none of that made much sense, no worries, the important bit to grasp is that libmp3tunes does these important things:
There are a few libmp3tunes shortcomings. One is the lack of a means to detect when a session has expired. Each MP3tunes API request requires a valid session (except of course the initial session-establishing request), and each session times out eventually. When using MP3tunes in Amarok it will be important to elegantly handle session timeouts, for the user does not care about sessions or timeouts. When the user clicks play on an artist they expect it to play, while currently, if the session has timed out Amarok doesn’t do anything. This week I will patch libmp3tunes to support detection of timed out sessions.
Another goal for this week is to fix the search box, so it actually searches.

Also, if you right click on an artist in the MP3tunes collection browser you get a “Copy to Collection” option. At the moment it doesn’t do anything. After this week is over, hopefully, selecting the “Copy to Collection” option will let you do just that.

Last week’s roadblock still stands. In the next few weeks I’ll be getting closer to the time when I will need to implement that syncing part of libmp3tunes into Amarok. The licensing issue won’t stop me from developing it on my own workstation of course, but it will have to be resolved before I can commit that part of library or code that implements it.
Prescriptum: These weekly reports will likely contain a bit of technical information that only other Amarok developers will understand. I do not like that idea, as I want these reports to be grokable by all, but since I haven’t yet decided on a format to present the info in a manner I like this will have to do for this first week.
I started coding for GSoC last Tuesday (May 27th) beginning with a simplification of the ServiceCollection hierarchy by combining ServiceDynamicCollection and ServiceCollection into one class. I also started creating the ServiceCollectionLocation’s. It is not implemented anywhere yet, and won’t need to be for awhile, but I started it as at the time I was waiting on mp3tunes to deliver their c sdk.
Leeo kindly created mp3tunes icons, which I committed on Saturday.
and 
During the week I kept nudging the mp3tunes developers to send me the c sdk, and Saturday the nudging paid off as I received a pre-release version of libmp3tunes. Even though it is a pre-release it is complete enough to match the current mp3tunes feature set in Amarok2. On Sunday I added libmp3tunes to the src tree, including the dependency detection. libmp3tunes is dependent on curl and libxml2, and if someone does not have them mp3tunes will be excluded from the build thanks to cmake.
Finally, today, I committed a ~750 line c++ wrapper for libmp3tunes to compartmentalize the unsightly c code.
You can see all my commits here:
http://kollide.net:8060/changelog/~author=link/Amarok
There are still a few functions left TODO in the c++ wrapper for libmp3tunes, so I’ll complete those this week. Then I plan to start migrating the existing service to use the library functions. I expect this will take all week, so my goal for the next report is to have the migration complete and a working Mp3tunes service utilizing the library. If my time estimation ends up being too long, and I finish the migration early, I’ll work on the Mp3tunesCollectionLocation functionality so you can copy tracks from Mp3tunes to the local collection in a manner similar to the Magantune service.
Forseeable Roadblocks:
The syncing part of libmp3tunes is not licensed and not complete. However, the MP3tunes developers have been particularly responsive the past several weeks, so I am optimistic they will pull through.
I am amazed at how much I learned this week. To keep this brief here is a list of some things I’ve learned: