Audio tag editor for GNOME Music
My project for Google Summer of Code, 2016 was to implement a tag editor for songs through the GNOME Music application.
The following were my original aims when I put forward my proposal as a candidate:
- Create a graphical frontend to enable the user to perform manual edits on atleast a single song at a time.
- Establish a platform that fetches automatic tags for the song from a webservice and present them to the user.
I achieved both these targets although with some inconsistencies that I'll continue to work on. But more on that later. The editor has exclusively been made for editing single songs only as of now. And automatic metadata is fetched using two web services simultaneously. The design and user experience are under consideration for the current editor as well as for any future extensions.
The user interface
Generating GUI elements for widgets in Gtk applications is done using XML formatted .ui files fed to a GtkBuilder. These resources are then connected to their corresponding functional behaviour and we're done. A more difficult part is deciding what should be presented as the UI. Our earlier design for manual edits only has been explained in this blog post. It remains very much unchanged except for new additions related to automatic suggestions.
The tracker backend
Tracker is a collection of daemons that run on all systems running GNOME 3. Its responsible for indexing files, extracting metadata, storing metadata, etc. behind the scenes. Most GNOME apps use tracker in some way. GNOME Music already uses them for accessing songs and their metadata. The SPARQL query standard is used to send query or update requests to tracker through grilo's tracker-wrapper. Any update SPARQL strings will result in an insert or delete or both on a file's metadata values using tracker-writeback daemon. Since GNOME Music didn't have any editing facilities before these queries had to be written from scratch.
Grilo's plugin relay
Grilo is a media discovery and browsing framework for application developers. It supports various plugins that help us access and manage data sent from web services upon requests. Three of these plugins are used one after another for fetching the final tags that are presented to the user.
- The chromaprint plugin generates a fingerprint from the physical song file using gstreamer's chromaprint library which itself was developed using AcoustID's chromaprint hashing algorithm.
- This fingerprint is passed to the AcoustID plugin that uses it along with duration to do a lookup for the song's MusicBrainz recording ID in the AcoustID database for a matching fingerprint.
- The recording ID is finally used nby the MusicBrainz plugin (that I wrote as a part of this project) to fetch the desired music tags such as artist, album, disc, genre, etc.
I wrote another blog about how I made it work. Much of the code there isn't really helpful. Look into the bug links given for more details.
What has been done
The following bugs contain references and discussion related to my entire work. The patches submitted have yet to be merged to their respective source products since there's still room for improvement.
- Bug 706352 for GNOME Music's tag editor feature
- Bug 741230 for MusicBrainz plugin request as a grilo-plugin
Does it work? Yes it does... except that MusicBrainz is undergoing some major revamp in its hosting platform. So there is an issue where you might get 'rate limit reached' replies even though you did not exceed the limit.
Whats left to do
Quite a lot of work needs to be done before the editor's full functionality is realized. Some major work is needed for:
- Extending the editor to support editing mulitple songs and full albums at once.
- Design improvement for current automatic tagging support and provide more than just one 'optimal' solution.
- Fix some update issues and some fairly complicated edge cases. Pushing fingerprints to AcoustID database is also a considerable feature.
Its been great working and learning this summer. I was invited to the annual GNOME developer's conference GUADEC where I got the opportunity to discuss the project with my mentor in person and gather some useful advice. We also had discussions with the design team on how we can provide a complete interface while also being elegant in its presentation. We will have a stable design very soon. I'll now take up the responsibility to make sure all these features are implemented and polished before they land in GNOME Music. Cheers!