forslund / spotify-skill

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

The skill tries to start playback even when no devices are connected #25

Closed InconsolableCellist closed 6 years ago

InconsolableCellist commented 6 years ago

I ran into the following issue when trying to setup spotify-skill for the first time on a headless server (not Mk. 1 or 2 hardware).

Steps to reproduce:

  1. Install the skill and configure it on home.mycroft.ai with your Spotify Premium credentials
  2. Start mycroft and utter "play something by "

Observed behavior: spotify-skill attempts to start playback even when no devices are connected, which is the state my system was in, having not started Spotify on my PC and having not installed librespot or spotifyd.

It produces the following error:

20:04:56.269 - mycroft.skills.core:wrapper:607 - ERROR - An error occurred while processing a request in Spotify Skill
Traceback (most recent call last):
  File "/home/user/mycroft-core/mycroft/skills/core.py", line 598, in wrapper
    handler(message)
  File "/opt/mycroft/skills/spotify-skill/__init__.py", line 580, in play_artist
    return self.search(message.data['Artist'], 'artist')
  File "/opt/mycroft/skills/spotify-skill/__init__.py", line 616, in search
    self.spotify_play(dev['id'], context_uri=res['uri'])
TypeError: 'NoneType' object has no attribute '__getitem__'

Uttering "what spotify devices are available" produces:

20:10:06.622 - SKILLS - DEBUG - {"type": "3725241627858187020:list_devices", "data": {"confidence": 0.6666666666666666, "target": null, "intent_type": "3725241627858187020:list_devices", "DHCFCEBGCHIFIBIHACASpotify": "Spotify", "__tags__": [{"end_token": 1, "start_token": 1, "from_context": false, "entities": [{"confidence": 1.0, "data": [["Spotify", "DHCFCEBGCHIFIBIHACASpotify"]], "key": "spotify", "match": "spotify"}], "key": "spotify", "match": "spotify"}, {"end_token": 2, "start_token": 2, "from_context": false, "entities": 

Which seems to indicate that it's not yet configured to point to any devices.

Expected behavior: The skill communicates the configuration state and suggests a solution for it, rather than attempting to play and throwing an error.

forslund commented 6 years ago

Resolved by #26. Closing