Wednesday, 11 September 2013

Amarok MTP (Android) GSoC: weeks 11 & 12 - Full Sync!

Yay, I've achieved a significant goal in my GSoC project to rewrite MTP (Android) support in Amarok from scratch. Yes, it is the ability to fully manage tracks on your MTP devices.
Amarok copying tracks to Android device
What I've done last weeks:
  • Added fancy progress bars when downloading/uploading/updating tracks on the MTP device. The progress bars are "cumulative", which means that there is only one progress bar for a given type of operation and device. Potential new jobs are added to it when it is already running.
  • Reworked locking in order not to hold 2 locks simultaneously. There are N + 2 locks in each MTP collection (where N is the number of tracks) and holding any 2 of them simultaneously creates a potential deadlock situation (unless lock order is preserved) and may stall the UI for significant time. I managed to sneak in a fancy static (compile-time) assertion because I had to provide a copy constructor for a libmtp library object.
  • Implemented removal of tracks on MTP device. This was rather easy, also comes with a progress feedback, but it is too fast to be screeshot-able. :)
  • And finally implemented copying/moving tracks to the MTP device. This means that Amarok is now able to fully manage audio content of your Android phones and other MTP devices! It took a bit of effort, but it works nicely now. I've even tested crazy things like plugging the device out in the middle of a move operation to check the behaviour is correct (it is and Amarok doesn't crash nor eat your kittens (YMMV)).
What's next:
  • Allowing to specify a folder structure and show human-readable folders for existing tracks.
  • A config dialog for each device.
  • Transcoding (low-level part is virtually done, only needs UI).
You can view and test my code by checking out gsoc branch of my personal Amarok clone repository.


  1. Expected release for this to be merged into?

  2. Hey Matej, there is something wrong with your scaling algorithm. The scaled down images look like you used a blur filter :)

  3. Yeah, they are pretty crappy. I blame Blogger. I'll try to avoid that in future, unfortunately some images are too big to show them at original size.

  4. Hi, I'm new to linux scene just discovered Amarok, it rocks! I have a large collection and Amarok delivers everything I was always looking for in dedicated audio/music player/manager...i know this is low on priority list of things to do..but I wish when i push "Next track" it would fade out/in sort of like when i push "Stop". Keep up the great work!!!

  5. Yeah, this is a requested feature also known as crossfading. We'd like to have it at some point, unfortunately it is a bit complicated to implement. You can track progress on and vote for associated wish: