beetbox / beets

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

deezer: Sometimes uses locale-specific name for "Various Artists" #4956

Open JOJ0 opened 9 months ago

JOJ0 commented 9 months ago

As you can see below, when tagging with Deezer plugin, it seem like since I'm located in a german speaking country, the API responds with german names for Various Artists releases. I assume we don't have a setting to ensure accessing the API "in english" ;-) Also note: My OS language is actually set to english! So it must be something with the location / the IP I'm coming from....

/path/to/music/John Handy; Hotep Cecil Barnard; Mike Hoffmann; Chuck Rainey; Eddie Bongo Brown; James Gadson - Jazz #1_s - Hard Work.mp3 (1 items)
Sending event: import_task_before_choice
Sending event: before_choose_candidate

  Match (63.3%):
  Verschiedene Interpreten - Jazz #1's
  ≠ artist, year, tracks
  Deezer, None, 2007, None, Universal Music Group International, None, None
  https://www.deezer.com/album/102392
  ≠ Artist: Various Artists -> Verschiedene Interpreten
  * Album: Jazz #1's
     * (#11) Hard Work (6:54)

Without further ado: If anyone wants to dig around in that plugin and point me somewhere, I will fix it. I see two possible ways:

arsaboo commented 9 months ago

There is a language option in the config.

JOJ0 commented 9 months ago

Thanks for that hint @arsaboo ! :-)

I tried to set it to

import:
    languages: ['en']

but unfortunately I don't experience a change in the results Deezer gives me. I still receive "Verschiedene Interpreten" instead of "Various Artists" in all my candidates.

Most probably this option does only affect MusicBrainz code - but I did in no means investiage any of this..... just noting it here and will report once I find the time to do that (or someone else is bored and wants to investiage? ;-))) haha

arsaboo commented 9 months ago

Interestingly, I don't even have languages in my config, but I have never seen this before. Is it possible that your location settings are not right?

sampsyo commented 9 months ago

Interesting! To make the implicit explicit, the likely thing going on here is that Deezer is using IP geolocation to guess which language you want and returning results accordingly. Beets is asking for the artist and getting this language-specific string from Deezer in the artist field.

I think the thing to do would be to see if the API provides any kind of metadata to identify VA releases in a language-independent way. That's what we do with MusicBrainz: https://github.com/beetbox/beets/blob/efc2cf70134721eadb9110adef335127dd926a7a/beets/autotag/mb.py#L37

Then beets could ignore the actual artist string and fill in a hard-coded "Various Artists" string instead?

GuilhermeHideki commented 7 months ago

I patched my deezer.py file with this.

-        album_data = requests.get(self.album_url + deezer_id).json()
+        headers = {"Accept-Language": "en-US,en;q=0.5"}
+        album_data = requests.get(self.album_url + deezer_id, headers=headers).json()

I didn't test with non-Latin (Cyrillic/CJK) artists in my library, to see if they change the names

JOJ0 commented 7 months ago

Awesome @GuilhermeHideki, you want open a PR submitting that change? Would be as my second bullet point suggests in the initial description.