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

Plays over Connect, but not locally #29

Open
Tafari opened this issue Apr 2, 2018 · 17 comments
Open

Plays over Connect, but not locally #29

Tafari opened this issue Apr 2, 2018 · 17 comments

Comments

@Tafari
Copy link

Tafari commented Apr 2, 2018

I can't figure out if I'm being a complete newb or misunderstanding the purpose of this Skill?

I can use it to play/control Spotify on another device, but it won't stream music directly through the Mycroft.

If I ask it to list all Spotify devices, it will list my PC, or None (depending if the PC has Spotify open or not). I'd like to stream Spotify directly through my Picroft, am I missing a trick here?

Thanks

@ConorIA
Copy link

ConorIA commented Apr 2, 2018

You can install Raspotify to turn Picroft into a client as well.

@forslund
Copy link
Owner

forslund commented Apr 3, 2018

The skill is basically a spotify connect skill and will play locally if there is a Spotify connect device there. as @ConorIA suggest you can install Raspotify on the picroft. This comes pre-installed on the Mark-1 but I'm not 100% sure it's bundeled on the picroft image. you might need to install it separately. If you configure the client to have the same name as the mycroft device the skill will default to this device.

@parthsuthar
Copy link

@forslund your comment

If you configure the client to have the same name as the mycroft device the skill will default to this device.

Does this mean that the raspotify device name (in the config /etc/default/raspotify) should have the same device name as mentioned on home.mycroft ?

@forslund
Copy link
Owner

forslund commented Apr 5, 2018

@parthsuthar yes that's best.

Edit:
A bit more info: when starting playback it checks for

  1. Currently active device
  2. A device with the same name as the Mycroft device
  3. A device with the same name as the hostname of the system (spotify on pc set's this as device name)
  4. If all else fails: The first device in the list of devices

@parthsuthar
Copy link

that works. thanks!

@JamesPoole
Copy link

@forslund I am running this on Mark 1 and I am seeing something similar to above. When I newly install the skill or reboot, it recognises Mark 1 as a Spotify device and works perfect but once I leave the Mark 1 alone for a few hours, it doesn't see itself as a device anymore and will only play to other devices.

Is this something you know about?

@forslund
Copy link
Owner

@JamesPoole I've seen this myself from time to time and asked the librespot team. Apparently the client doesn't gracefully handle disconnects from from the spotify servers. And can be left hanging in a running but not connected state.

I'll see if I can create a workaround restarting the client if it seem to be lost.

@JamesPoole
Copy link

Super, thanks for all the work!

@DeIonizedPlasma
Copy link

@forslund am running this in a raspbian instance with mycroft installed, and it seems to be failing to recognize the spotify device. Raspotify is installed, and the device name for raspotify is correctly configured. The device is properly paired with my spotify account. When I attempt inputting "pause spotify", I get the following error:

17:02:08.595 - mycroft-spotify_forslund:__pause:779 - INFO - Pausing Spotify...
17:02:08.764 - mycroft-spotify_forslund:pause:184 - ERROR - http status: 404, code:-1 - https://api.spotify.com/v1/me/player/pause?device_id=None:Device not found

Is there a config somewhere I missed?

@forslund
Copy link
Owner

@DeIonizedPlasma That looks like a bug, thanks. I'm not sure it'll do much harm though.

Currently mycroft can only pause spotify playback it has started in the first place. In the case above it looks like there is no current device id so the pause command fails. this would be expected if mycroft did not start playback.

@DeIonizedPlasma
Copy link

Thanks for the quick reply. I know that mycroft was properly connecting to spotify, because when I stopped all mycroft processes it paused spotify playing on a different device.

I think I may have fixed it now, although I'm not sure how. I had been running mycroft in debug mode, and upon switching to just cli it seems to be partially working. It won't pause/play if I attempt to do so immediately after starting, regardless of whether I am playing music on another device. If I tell it to play a song, it will do so on whatever device is set to play through spotify, and will then play/pause properly on all devices. The only thing that seems strange about this operation is the need to queue a song first on mycroft even if all the controls are for audio on a different device.

@TheLastProject
Copy link
Contributor

I'm a bit confused about the suggestion to install and configure raspotify. From what I can see, the skill tries to manage "librespot" itself if the device is in MANAGED_PLATFORMS. If I disable this MANAGED_PLATFORMS check, simply having librespot installed seems to be enough to make it all work. So I'm wondering, why is this MANAGED_PLATFORMS check there? All it seems to do is break the ability to play on the speaker on Picroft without manually installing and configuring a complete Raspotify installation as well (as opposed to only having librespot installed).

@forslund
Copy link
Owner

Raspotify is the name of the package for the pi. It installs librespot and sets up aservice running it

@forslund
Copy link
Owner

The problem with picroft is that the sysyem isn't set up with the application preinstalled. The same goes for desktop installations where librespot need to be built from source or the spotify desktop app can be used.

@TheLastProject
Copy link
Contributor

Yeah but won't it just fall back to trying to play on another device when it can't run librespot locally?

Even if you install raspotify, that isn't enough on the Picroft, you have to manually configure that service to run it. Just installing it seems to be enough if you remove the MANAGED_PLATFORMS check though

@forslund
Copy link
Owner

You should also shutdown the service so two instance aren't running.

@fermulator
Copy link

similar to #135 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants