beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.73k stars 1.82k forks source link

Include artist country and start/end date in artist info #2338

Open Freso opened 7 years ago

Freso commented 7 years ago

When looking up artist information on MusicBrainz, their area and start/end dates are also returned. It would be neat to have this information included as well, so you could use this information for path names (e.g., /path/to/music/Redžepova, Esma (1943–2016)/…), searches ("show me music performed by people from Uganda born in September"), etc.

This would obsolete the 3rd party plugin beets-artistcountry and it would thus probably be good to reuse the $artistcountry variable from that, if it makes sense.

Freso commented 7 years ago

Note that there might be issues with artists that have their area set to a non-country, e.g., https://musicbrainz.org/area/01428650-fbe2-4aab-aca2-a1d562a93caf/artists or https://musicbrainz.org/area/a71b0d32-7752-49e9-8594-2247ad6ac12c/artists – the former will not resolve to a country, but the latter might, and I have no idea how the web service handles these.

Freso commented 7 years ago

Oh, and note that the beets-artistcountry plugin doesn't have a license declared, so it isn't possible to just copy code over from that, as tempting as it might be. :/

ameyad2209 commented 7 years ago

Hi, my name is Ameya Deshmukh. I'm participating in the Google Code-in, and want to complete this task for MetaBrainz Foundation at the earliest so that I can go on to complete more. I'm really passionate about programming, and a fan of quick completion as well, especially now. So, let's start! My Google Code-in username is ameyad2209.

sampsyo commented 7 years ago

Great to meet you, @ameyad2209! Thanks for volunteering.

To get started, and to set up a copy of beets for hacking, I suggest taking a look at our wiki, here: https://github.com/beetbox/beets/wiki/Hacking

Then, the place where the code will go for this task will be beets/autotag/mb.py. That's where we extract all the information we need about albums and artists from MusicBrainz API results. Then, you will want to do a little exploring to find out where the relevant information is stored in the MB API results. I think the right place to start here will be in the _flatten_artist_credit function in that file. You can start by just printing out the API response (i.e., print(credit) at the top of that function). Then, you can add code to extract the right data and return it from that function, and from there we'll store it in the database.

Does that make sense so far?

ameyad2209 commented 7 years ago

Yes, it does. I'll be doing this using the urllib/urllib2 module in Python. It's pretty basic, but I'm only a beginner in Python, and not an expert. You can expect the raw code as a notepad file within 3 hours. Thanks a lot for guiding me. This is one of the more challenging tasks, and I wish to complete as many of them as possible, as, frankly, I get a huge rush out of solving challenging problems and that too in a great amount. Thanks again for all the help! Cheers!