forslund / spotify-skill

Mycroft Skill to control spotify using the Spotify Connect API
Apache License 2.0
71 stars 38 forks source link

Can't obtain song meta information #168

Closed theCalcaholic closed 2 years ago

theCalcaholic commented 2 years ago

I have set up the skill according to the instructions in the readme. Furthermore, I have setup SpoCon as Spotify Connect client on the device. I can verify that it worked, by checking for the available devices ('what spotify devices are available'), which gives me the expected device list.

However, when I try to play anything, I get an error "Unable to obtain the name, artist, and/or URI information while asked to play something. User info has been set but Auth failed". Surprisingly, it actually starts the playback, though.

Here is the complete output:

23:52:42.364 | INFO     |  7033 | Playback Control Skill | Resolving Player for: something from fink
 23:52:43.475 | INFO     |  7033 | PianobarSkill | 'NoneType' object is not subscriptable
 23:52:43.602 | INFO     |  7033 | SpotifySkill | Spotify confidence: 0.85
~~~~], 'limit': 10, 'next': 'https://api.spotify.com/v1/search?query=fink&type=artist&offset=10&limit=10', 'offset': 0, 'previous': None, 'total': 547}}, 'name': None, 'type': 'artist'}
~~~~], 'limit': 10, 'next': 'https://api.spotify.com/v1/search?query=fink&type=artist&offset=10&limit=10', 'offset': 0, 'previous': None, 'total': 547}}, 'name': None, 'type': 'artist'}
 23:52:48.213 | INFO     |  7033 | Playback Control Skill | Playing with: mycroft-spotify.forslund
 23:52:48.281 | INFO     |  7033 | Fairytalez | stop is called
 23:52:48.338 | INFO     |  7033 | Playback Control Skill | Audio service status: {}
 23:52:48.725 | INFO     |  7033 | SpotifySkill | Device detected: DeviceType.DEFAULT
 23:52:48.725 | INFO     |  7033 | SpotifySkill | playing artist
 23:52:50.727 | INFO     |  7033 | SpotifySkill | spotify_play: 0c7cf26f056c7060f61a335e9a53a086c87c953f
 23:53:00.863 | ERROR    |  7033 | spotipy.client | Max Retries reached
 23:53:00.864 | ERROR    |  7033 | mycroft-spotify_forslund.spotify:play:189 | http status: 429, code:-1 - /v1/me/player/play?device_id=0c7cf26f056c7060f61a335e9a53a086c87c953f:
 Max Retries, reason: too many 502 error responses
 23:53:00.864 | ERROR    |  7033 | SpotifySkill | Unable to obtain the name, artist, and/or URI information while asked to play something.
 23:53:00.864 | ERROR    |  7033 | SpotifySkill | User info has been set but Auth failed.

and the error message as spoken by Mycroft: "Unable to authorize with the Spotify service. Please go to Skill settings at home dot mycroft dot ai to verify your username and pasword and connect to spotify."

forslund commented 2 years ago

I haven't been able to reproduce it. The 502 error may indicate an issue on the spotify api. is it still an issue? It may be that the device id was changed and the cached device id caused the issue?

I will also look into the error report because it seems to hit the wrong one.

Edit: will also try spocon since I've only used the rust version of librespot in case there is some specific issues with it.

theCalcaholic commented 2 years ago

Just to make sure I correctly understand what's going on: I interpret the issue as the SpotifySkill not being able to retrieve information from the spotify API. Is that correct? Because, in that case, I don't see how it could be relevant which (connect) device is being used for playback

theCalcaholic commented 2 years ago

But I'll test later with my phone as playback device as well as librespot

forslund commented 2 years ago

I'm not quite sure of that. It seems to me like it's trying to play the artist. The text in the debug message is a bit misleading since the actual exception error seems to be missing from the text. It looks like it tries to start the playback but fails to a 502 error. The extraction of data doesn't hit the api at this stage.

Can you give me an example of an artist that fails for you. Also can you try to change L1071 of init.py to self.log.execption instead of self.log.error to provide more details.

theCalcaholic commented 2 years ago

Actually... It just works now :eyes: So you might be right, that it was related to caching the wron client id or something. Thank you and sorry for the work it caused

forslund commented 2 years ago

Glad it works now. Let me know if it happens again. If it is common we need to adress it somehow