Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Artists with non-English name may not be able to obtain image #2377

Open
3 tasks done
Cnicehs opened this issue Jun 1, 2023 · 10 comments · May be fixed by #2835
Open
3 tasks done

[Bug]: Artists with non-English name may not be able to obtain image #2377

Cnicehs opened this issue Jun 1, 2023 · 10 comments · May be fixed by #2835
Labels
bug triage New bug reports that need to be evaluated

Comments

@Cnicehs
Copy link

Cnicehs commented Jun 1, 2023

I confirm that:

  • I have searched the existing open AND closed issues to see if an issue already exists for the bug I've encountered
  • I'm using the latest version (your issue may have been fixed already)

Version

0.49.3

Current Behavior

Log

level=warning msg="Artist not found in Spotify" artist="豊永利行"
level=warning msg="Artist not found in Spotify" artist="米津玄師"
level=warning msg="Artist not found in Spotify" artist="平沢進"

One of Spotify Respond

平沢進

Request URL:

https://api.spotify.com/v1/search?q=%E5%B9%B3%E6%B2%A2%E9%80%B2&type=artist

Respond:

{
  "artists" : {
    "href" : "https://api.spotify.com/v1/search?query=%E5%B9%B3%E6%B2%A2%E9%80%B2&type=artist&locale=zh-CN%2Czh%3Bq%3D0.9%2Czh-TW%3Bq%3D0.8&offset=0&limit=20",
    "items" : [ {
      "external_urls" : {
        "spotify" : "https://open.spotify.com/artist/6kaueP97pX7WZoOwF8XsI2"
      },
      "followers" : {
        "href" : null,
        "total" : 120388
      },
      "genres" : [ "anime score", "japanese alternative pop", "japanese electropop", "japanese soundtrack" ],
      "href" : "https://api.spotify.com/v1/artists/6kaueP97pX7WZoOwF8XsI2",
      "id" : "6kaueP97pX7WZoOwF8XsI2",
      "images" : [ {
        "height" : 640,
        "url" : "https://i.scdn.co/image/ab6761610000e5ebf0a9a67d18a96b163d395984",
        "width" : 640
      }, {
        "height" : 320,
        "url" : "https://i.scdn.co/image/ab67616100005174f0a9a67d18a96b163d395984",
        "width" : 320
      }, {
        "height" : 160,
        "url" : "https://i.scdn.co/image/ab6761610000f178f0a9a67d18a96b163d395984",
        "width" : 160
      } ],
      "name" : "平沢進",
      "popularity" : 45,
      "type" : "artist",
      "uri" : "spotify:artist:6kaueP97pX7WZoOwF8XsI2"
    }, {
      "external_urls" : {
        "spotify" : "https://open.spotify.com/artist/2CoZQhgQjymHwIIkogCx9r"
      },
      "followers" : {
        "href" : null,
        "total" : 37441
      },
      "genres" : [ "japanese new wave", "japanese post-punk", "synth punk", "zolo" ],
      "href" : "https://api.spotify.com/v1/artists/2CoZQhgQjymHwIIkogCx9r",
      "id" : "2CoZQhgQjymHwIIkogCx9r",
      "images" : [ {
        "height" : 640,
        "url" : "https://i.scdn.co/image/ab67616d0000b2738463a5500938eb505edb5028",
        "width" : 640
      }, {
        "height" : 300,
        "url" : "https://i.scdn.co/image/ab67616d00001e028463a5500938eb505edb5028",
        "width" : 300
      }, {
        "height" : 64,
        "url" : "https://i.scdn.co/image/ab67616d000048518463a5500938eb505edb5028",
        "width" : 64
      } ],
      "name" : "P-MODEL",
      "popularity" : 23,
      "type" : "artist",
      "uri" : "spotify:artist:2CoZQhgQjymHwIIkogCx9r"
    } ],
    "limit" : 20,
    "next" : null,
    "offset" : 0,
    "previous" : null,
    "total" : 2
  }
}

Expected Behavior

non-English name can also be able to obtain image

Steps To Reproduce

No response

Environment

No response

How Navidrome is installed?

Docker

Configuration

No response

Relevant log output

No response

Anything else?

No response

Code of Conduct

  • I agree to follow Navidrome's Code of Conduct
@Cnicehs Cnicehs added bug triage New bug reports that need to be evaluated labels Jun 1, 2023
@certuna
Copy link
Contributor

certuna commented Jun 6, 2023

Is this an issue with Navidrome or with the Spotify API?

@Cnicehs
Copy link
Author

Cnicehs commented Jun 8, 2023

Is this an issue with Navidrome or with the Spotify API?

I think it should be Navidrome , I have found the correct item in his response when I use Spotify API

@reopt999
Copy link
Contributor

I've looked into this, some Japanese artist can still their images obtained. However there is an internal checking whether the searched artist name is the same as artist name from metadata:

core/agents/spotify/spotify.go

	// If the first one has the same name, that's the one
	if strings.ToLower(artists[0].Name) != name {
		return nil, model.ErrNotFound
	}

For some artist, artist name obtained from Spotify API is romanized, for example: 平沢進 is listed as Susumu Hirasawa. Not sure if there is a localization setting in the API, as the response JSON you attach is properly listed in Japanese

@reopt999
Copy link
Contributor

There is a "market" parameter for the spotify search API, but I'm not sure it will help as in the documentation it says that the parameter only changes whether the item is available in certain countries or not. Also the country region of the the user will take precedence over this parameter.

For reference: https://developer.spotify.com/documentation/web-api/reference/search

I guess the fix would depend whether we want to just trust the first search result (as we did, but right now we double check whether it is the same as our file's metadata - which is the root cause of the bug) or maybe we could refer to other information to get the proper artist image

I would like to work on this issue after we decided which approach we should take

Copy link

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Navidrome team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@github-actions github-actions bot added the stale label Dec 24, 2023
@vnghia
Copy link

vnghia commented Jan 1, 2024

just commenting to avoid staleness. I am thinking about using the LANG tag in the music file to detect the market. Is that something feasible ? Furthermore, is there a way to load the artist images manually without going throught the directory structure, like <artist-name>.jpg or so ?

@github-actions github-actions bot removed the stale label Jan 2, 2024
@kosukesando
Copy link

kosukesando commented Jan 30, 2024

So other japanese devs have also faced this issue and have found that adding a Accept-Language: ja header in the curl request works.
I think this combined with @vnghia 's suggestion will work for other languages as well, given that the music file actually has that tag.
BTW I wanted to use MusicBee to download and manage the artist images as artist.jpg in the artist folder alongside the album folders, but apparently it only handles that for album covers...bummer.

EDIT:
On second thought, it might be easier if we just let the user choose which languages to search for, instead of relying on tags. I guess it's a bit spammy in a way from Spotify's POV since we'll send as many requests per artist instead of 1, but this operation is pretty negligible since it's only a one time thing.

@metalheim
Copy link
Contributor

Adding an artist.jpg should work too, if all files for that artist are in/below that Artist folder.

https://www.navidrome.org/docs/usage/artwork/#artists

@deluan
Copy link
Member

deluan commented Jan 31, 2024

EDIT:
On second thought, it might be easier if we just let the user choose which languages to search for, instead of relying on tags. I guess it's a bit spammy in a way from Spotify's POV since we'll send as many requests per artist instead of 1, but this operation is pretty negligible since it's only a one time thing.

I think the correct behaviour is to use the language tag from the file. We don't want to spam Spotify's API to avoid bumping into rate limits or worse, having them blocking Navidrome for all users!

And it will be only one request per artist. Once we get a response from Spotify, the images are saved in the cache.

If anyone wants to work on this, they are more than welcome :)

Furthermore, is there a way to load the artist images manually without going throught the directory structure, like .jpg or so ?

@vnghia, currently the way artist images are resolved is described in the link posted by @metalheim above: https://www.navidrome.org/docs/usage/artwork/#artists

@kosukesando
Copy link

kosukesando commented Jan 31, 2024

I've created a PR utilizing the "SortArtistName" which should be in Latin characters for any artist. I've noticed just now that navidrome has musicbrainz integration, so I guess that is also another way we could query/match the artist name, but the PR addresses most of the problems I had initially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage New bug reports that need to be evaluated
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants