GSoC 2020: To make MusicBrainz for Android robust and stable

Tags: #<Tag:0x00007f756aaef178>

Personal Information
IRC Nick: _lucifer
Email: lucifer@metabrainz.org
I have been working actively on the MusicBrainz for Android project for over a year.

To make MusicBrainz for Android stable and robust

Background and Overview

The project has been under constant development for almost a year now. In the past one year, the app has been reworked to compile with the current Android ecosystem. Users can view release information by scanning a barcode, search information about artists, releases, release groups,labels, recordings, instruments, and events , view collections, tag their audio files (to a limited extent) and donate to the MetaBrainz Foundation via PayPal. The application has been released as a beta version on the Play Store for testing purposes.

At the same time, much work still has to be done. There are multiple reasons why the application has not entered a production release. The application only has a minimal UI and has many bugs here and there. One of the reasons for this is the lack of a comprehensive test suite and a continuous integration pipeline.

Technical Overview

Here is an exhaustive list of tasks, I intend to undertake as a part of GSoC. I have also

mentioned an estimate of the time required to do each of them.

Step 1 : Fixing the codebase

At this time, MusicBrainz Android application provides the facility to search for an artist/release in the database and to view collections if a user is authenticated. A lot of bugs have been observed in these features.

  • Network errors and invalid requests to the API fail silently. The progress bars and generic error pages are present in the code base but do not function properly (UI bugs).
  • Some users have repeatedly reported that the authentication procedure malfunctions. There are some other minor bugs here and there as well.

The app will be tested extensively to eliminate such bugs.

Step 2: Adding a test suite

Bugs can creep in the codebase at any time. To keep bugs at a bay, an extensive test suite will be written for the testbase.

This includes writing unit tests for testing

  • Network calls for searching and browsing entities in the MusicBrainz database when the user is logged in and logged out

  • Parsing of response received from MusicBrainz WS/2 JSON API and CoverArt Archive

  • Reading and writing metadata of audio files

The next part will be writing instrumentation test which require to be run on physical devices or emulators

  • UI tests using Espresso test suite. This includes testing ViewModels, Livedata and Recycler view etc.
  • Accessing audio files on a device and reading and writing metadata to these.

Step 3: Setting up CI

A continuous integration pipeline will ensure that the application works at all times in all development and production. The CI pipeline will automate running tests. Some important notes about setting up a continuous integration setup are noted here.

  • A sample CI setup using CircleCI has been done in my fork of musicbrainz-android repo.
  • The sample setup currently builds successfully but by disabling some of linting checks which is not desirable. Fixing this will require handling of incomplete translations and recompiling the JAudioTagger library from source to remove the image handling parts.
  • Preparing the CI for Android NDK since JAudioTagger is planned to be replaced by TagLib.
  • Instrumentation Tests cannot be run directly in a CI environment. Firebase Test Lab provides the ability to do this. It is a paid product but comes with a free tier. The Firebase Test Lab will be integrated into the CircleCI setup for more comprehensive testing.
  • Setup the pipeline for automatic deployment to Google Play Store for every production and beta release.

Step 4: Modularizing the application

The application will be made modular by splitting it into a UI, Data and Tagging layer. The UI and Data layer will be a part of the Android application module and the Tagging layer will be a part of a separate library module. The Tagging module is dependent on the underlying platform. The UI can be made independent by using a cross platform technology like React Native. This can benefit in development and maintenance of iOS and Android applications.

For the purpose of this project, the interface layers between the two modules will be created so that the two can be developed independently.

Step 5: Replacing JAudioTagger

JAudioTagger is not a good fit for the application. It lacks several features and does not support many formats supported by Mutagen (tagging library used by Picard). Since, no suitable Java alternative is available and Android offers first class support for Native code through NDK, Taglib has been chosen as a replacement. This will require a JNI to communicate with the Taglib.

Step 6: Preparing the UI

The UI needs to be prepared to show the results of potential matches, the present tags and the edited values.

Step 7: Stretch Goals

  • Moving the codebase to Kotlin.
  • To improve performance of the app, a local cache database using Room will be implemented to store latest query results.
  • Add functionality to search using voice.
  • To create a Google assistant action for the app. With this, the app’s features can be directly accessed using Google Assistant.

Weekly Schedule

I intend to begin coding right from the start of the community bonding period.

Phase 1

Week 1 - 2 : Fix bugs in MusicBrainz Android.

Week 3 - 4 : Write unit tests.

Week 5 - 6 : Write instrumentation tests and complete CI setup.

Phase 2

Week 7 - 8 : Write interfaces to interconnect the modules and modularize the application.

Week 9 : Work on JNI for connecting to TagLib.

Phase 3

Week 10 -11 : Work on JNI for connecting to TagLib.

Week 12 and beyond : Buffer period and stretch goals.

Detailed information about yourself

Tell us about the computer(s) you have available for working on your SoC project!
I have a HP laptop with 8GB RAM, 1TB Hard disk and 2GB graphics card. The main tool required for the task is Android Studio which runs smoothly on this system.

When did you first start programming?
I started programming when I was in Grade VI as a part of school curriculum.

What type of music do you listen to? (Please list a series of MBIDs as examples.)
I love listening to Punjabi Music. Some of my favorite artists are Amrinder Gill, Sidhu Moose Wala & Guru Randhawa.

What aspects of the project you’re applying for (e.g., MusicBrainz, AcousticBrainz, etc.) interest you the most?
The prospects of cleaning up my entire music library on my mobile automatically sounds just great. Also I prefer mobile apps to websites, so I am making work easier for me with projects.

Have you ever used MusicBrainz to tag your files?
Yes, I use it regularly on a weekly basis or so.

Have you contributed to other Open Source projects? If so, which projects and can we see some of your code?
I have contributed to a couple of other open source projects which can be seen at my Github Profile. I have been the co-moderator of an app built to raise awareness on women safety.

If you have not contributed to open source projects, do you have other code we can look at?
I have done many programming projects. Many of them are personal ones. I usually do Android projects but I have worked on a few python projects as well. The apps I have built include a news app, a notice delivery app for my school and some fun personal projects.

What sorts of programming projects have you done on your own time?
I will be working full time on this project in GSoC.

How much time do you have available, and how would you plan to use it?
No, I don’t have any such plans.