Ritiek Malhotra Just some of my adventures!

Final GSoC update on musicbrainz_rs

This post is a follow-up of what I’ve been working on since my last post, for my involvement as a GSoC student with musicbrainz_rs.

What we’ve achieved since then

Relationship Level Includes

  • We now support requesting for relationship level includes from the web-api. These can requested similar to the way how other includes are requested for.
      let polly = Recording::fetch()
          .id("af40d6b8-58e8-4ca5-9db8-d4fca0b899e2")
          .with_work_relations()
          .with_work_level_relations()
          .execute()
          .unwrap();
    
      let relations = polly.relations.unwrap();
    
      assert!(relations.iter().any(|rel| rel.target_type == "work"));
    
  • We now also have search implemented on most of the entities supported by musicbrainz.
      use musicbrainz_rs::entity::area::AreaType::*;
      use musicbrainz_rs::entity::area::*;
      use musicbrainz_rs::Search;
    
      let query = AreaSearchQuery::query_builder()
          .area("London")
          .and()
          .tag("place")
          .build();
    
      let result = Area::search(query).execute().unwrap();
    
      assert!(result
          .entities
          .iter()
          .any(|area| area.area_type.as_ref().unwrap() == &City));
    

    The ones still missing the search implementation are the Place and Tag entity.

    There’s some inconsistency in the API response for the Place entity which I reported here. We should probably wait before implementing search on the Place entity and see maybe see if this can be resolved from the musicbrainz side itself otherwise we’ll have to workaround this in our library as we currently parse the coordinates as f64 which fails when attempting to use the same coordinate struct to also parse the search response.

    On the other hand Tag entity requires http digest authentication which isn’t implemented in musicbrainz_rs at the moment. Tag search will need to be implemented once we have authentication up.

These are the main things we worked upon last month. I also fixed some mis-matches with the web-api in our library, improved docs, and a little bit of refactoring.

All of my PRs made during the GSoC period can be found here.

Wrapping up

There are still quite a few things that could be done in musicbrainz_rs as detailed in the issues section. Overall, I had a great time working on musicbrainz_rs these few months and would like to thank MetaBrainz Foundation and my mentor, Paul for providing me with this opportunity, letting me take the wheel for a while, and dealing with my cute questions all along the way! I’m starting to feel a tiny bit more confident in Rust now.

I’d love to contribute to musicbrainz_rs if I get the chance in future, but for now I’ve got to focus on other things. My college is over and I’m yet to find out what awaits for the future next!


You can also read a more detailed version of this post and about my final work submission at:

https://blog.metabrainz.org/2021/08/23/gsoc-2021-complete-rust-binding-for-the-musicbrainz-api/.