sp_user_display_name always returns canonical name

2019-09-09 09:41发布

问题:

Hello Spotify community =) I've been beating my head against this for a while. When I ask libspotify for the owner of a playlist via sp_playlist_owner, I am never able to get the user's display name out from sp_user_display_name.

In the API, it mentions that the display name is only available after the user has been loaded. Specifically, this should be when sp_user_is_loaded returns true. However, I have found this to not be the case.

I have hooked into every available playlist callback in an attempt to catch when the user is loaded, and then output both the canonical and display names. I am doing this for a playlist where I know the canonical and display names of the owner are different.

  • In the case of a fresh start (deleting the settings directory before invoking sp_session_create), I initially get the Spotify log message UserCache::initiateGetUsers() will query for 1 users. Subsequent callbacks then indicate that the user has been loaded, but the canonical name is always returned.

  • In the case of a restart (where the playlist data is loaded from disk), I don't get the log message mentioned above, and the user is initially indicated as loaded. But again, the same problem. I am only ever given the canonical username.

Is this a bug in the API, or am I missing something?

回答1:

I believe that the full display name is only available in libspotify for the currently logged-in user, and then only if they logged in with Facebook credentials.