Open fermulator opened 4 years ago
I've started some better picroft documentation:https://github.com/forslund/spotify-skill/blob/feature/device-instructions/README.md
The short-short version is: install raspotify set device name and user / password in the raspotify config file, then reboot or restart the raspotify service
hm OK! I was missing explicit configuration on the raspotify
, but after doing so and a restart of that services, and a restart of the entire pi ... still didn't work;
started over:
(.venv) pi@picroft:~ $ msm remove mycroft-spotify
INFO - building SkillEntry objects for all skills
INFO - Best match (1.0): mycroft-spotify by forslund
INFO - Successfully removed mycroft-spotify
INFO - invalidating skills cache
(.venv) pi@picroft:~ $ msm install spotify
INFO - building SkillEntry objects for all skills
INFO - Best match (0.9): mycroft-spotify by forslund
INFO - Downloading skill: https://github.com/forslund/spotify-skill
INFO - Successfully ran requirements.sh for mycroft-spotify
INFO - Installing system requirements...
INFO - Installing requirements.txt for mycroft-spotify
INFO - Successfully installed mycroft-spotify
INFO - invalidating skills cache
on the raspotify side, looks like the config file doesn't work
, see https://github.com/dtcooper/raspotify/issues/279
: oops, it isn't /etc/default/raspotify.conf
it is /etc/default/raspotify
;o
after editing it and restarting, I now see the device as a playback item for "real" spotify clients (iphone)
but still:
spotify devices DEBUG output
>> I couldn't find any Spotify devices.
so spotify on the pi for me is neither showing the local playback device nor the soundbar; all on same network/subnet
ugh; I just went back to https://account.mycroft.ai/skills, and all my spotify stuff is gone! ;/ is that normal? (because of the remove/install?)
waited for:
mycroft.skills.mycroft_skill.mycroft_skill:handle_settings_change:308 | Updating settings for skill SpotifySkill
~~~~ | 643 | mycroft.skills.settings:save_settings:111 | Skill settings successfully saved to /home/pi/.config/mycroft/skills/mycroft-spotify.forslund/settings.json
confirmed the pulled remote config is now correct again
13:41:47.662 | INFO | 643 | Playback Control Skill | Resolving Player for: music spotify
~~~~.670 | INFO | 643 | mycroft.util:wait_while_speaking:58 | mycroft.utils.wait_while_speaking() is depreciated, use mycroft.audio.wait_while_speaking() instead.
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
13:41:52.609 | INFO | 643 | SpotifySkill | Handling "music spotify" as a genric query...
13:41:52.609 | INFO | 643 | SpotifySkill | Checking users playlists
13:41:52.879 | INFO | 643 | SpotifySkill | Checking artists
Removing event mycroft-spotify.forslund:launch_librespot
13:41:53.174 | INFO | 643 | SpotifySkill | Checking tracks
13:41:53.521 | INFO | 643 | SpotifySkill | Checking albums
13:41:53.869 | INFO | 643 | SpotifySkill | ('music spotify', 'fast soul music (spotify exclusive commentary version)', 0.4880597014925373)
13:41:53.870 | INFO | 643 | SpotifySkill | Checking tracks
13:41:54.405 | INFO | 643 | SpotifySkill | Spotify confidence: 0.5561403508771929
~~~~'https://api.spotify.com/v1/search?query=music+spotify&type=track&offset=10&limit=10', 'offset': 0, 'previous': None, 'total': 682}}, 'name': None, 'type': 'track'}
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
13:41:57.431 | INFO | 643 | Playback Control Skill | Playing with: mycroft-spotify.forslund
13:41:57.933 | INFO | 643 | Playback Control Skill | Audio service status: {}
13:41:59.028 | INFO | 643 | SpotifySkill | Device detected: DeviceType.DESKTOP
13:41:59.029 | ERROR | 643 | SpotifySkill | Unable to get a default device while trying to play something.
>> Spotify couldn't start playback: There are no Spotify devices available.
If your other devices sees it but not the skill that would indicate that it's in discover mode and not actually logged in but I can't tell for sure.
Gonna try to get time to verify the picroft guide from scratch tonight
For me the instructions worked, but after a couple of hours librespot seemed to lose connection to spotify.
Can you try the branch new-managed
and run
systemctl disable raspotify
systemctl stop raspotify
This would make the skill responsible for launching librespot as it needs it.
OK flipped the skill to
(.venv) pi@picroft:~/mycroft-core/skills/mycroft-spotify.forslund $ git status
HEAD detached at origin/new-managed
nothing to commit, working tree clean
, then disabled and stopped the services;
but then what? (wouldn't I need to reload the skill or restart mycroft? - else the skill is still running on the previous code?)
13:22:31.136 | INFO | 18069 | mycroft.skills.skill_loader:load:114 | ATTEMPTING TO LOAD SKILL: mycroft-spotify.forslund
13:22:31.340 | INFO | 18069 | mycroft.skills.settings:get_local_settings:78 | /home/pi/.config/mycroft/skills/mycroft-spotify.forslund/settings.json
Removing event mycroft-spotify.forslund:SpotifyLogin
Removing event mycroft-timer.mycroftai:ShowTimer
Removing event mycroft-spotify.forslund:SpotifyLogin
13:22:36.387 | INFO | 18069 | mycroft.skills.skill_loader:_communicate_load_status:280 | Skill mycroft-spotify.forslund loaded successfully
(.venv) pi@picroft:~/mycroft-core/skills/mycroft-spotify.forslund $ msm list -i | grep spotify
INFO - building SkillEntry objects for all skills
INFO - building SkillEntry objects for all skills
INFO - invalidating skills cache
mycroft-spotify [installed]
, still no spotify devices <<
hmmmm i went back to account skills and the spotify config is empty again :( ... https://account.mycroft.ai/skills (how is it possible this keeps getting reset? or is that normal?)
(.venv) pi@picroft:~/mycroft-core/skills/mycroft-spotify.forslund $ cat /home/pi/.config/mycroft/skills/mycroft-spotify.forslund/settings.json
{"__mycroft_skill_firstrun": false, "user": "", "Spotify": 1, "password": "", "use_ducking": false, "default_device": ""}(.venv)
(also note; if we disable raspotify to be controlled only by mycroft skill ... then other devices won't be able to play off the mycroft speaker anymore ;/)
The spotify skill should reload automatically when you switch branch,
I can't say what's happening on the backend with the settings. It will be removed if no mycroft-core skill manifest contains the skill. But that shouldn't be the case when switching branch. it will switch from a stable id to an "unstable" id but should still exist.
The skill will start librespot with the credentials set on mycroft-home so it should launch librespot and other devices can control it. It will also restart librespot if you request playback and it doesn't see the librespot device (some communication error has occured).
If the skill settings are available the skill should start librespot for you. and ps aux | grep librespot
should show something. If the settings are empty it will not start librespot until it receives user / password.
Edit: I would prefer not to control raspotify from the skill, mainly wanted to check if it would do any difference (since this makes it basically work the same way as the Mark-1)
reset the account skills again, picroft confirms receipt; (fair enough on the uncertainty of account settings loss, it is wonky for sure; just causing a pain in debugging this as suddenly I realize ACK! my settings are wiped, so it invalidates some testing results)
confirming after this,
(.venv) pi@picroft:~ $ ps aux | grep librespot
pi 28445 0.1 0.6 29092 6140 pts/0 Sl 02:53 0:00 librespot -n mycroft-kitchen -u <USERNAME> -p <PASSWORD>
(yikes, PW plain text in the settings and process commands ;o)
reloaded mycroft CLI:
spotify devices DEBUG output
>> I see the Spotify devices named: mycroft-kitchen and [AV] back den soundbar
woohoo! it sees itself and the soundbar now
(should i drop it back to main branch and retest to see if this managed
consideration is relevant?)
Great that it works, I'd like to get away from the plaintext u/p issue there by supporting discovery (U/P is sent encrypted over http(s) to the player) But I'll need a day or so to focus on the issue. Maybe during my vacation :)
The "managed" shouldn't do anything different than the raspotify system service so it be cool if you could see if you can get it working without the spotify skill managing. I think it's better to not to have the skill manage librespot and leave that to the system.
Wellp, this didn't go so well. After I reverted back to master
branch, and re-enabled raspotify service & started it, and resarted again, the spotify integration stopped working again.
:(
list spotify devices voice.log --- 13.79
>> I'm not sure I understood you.
play classical on spotify
>> Give me a moment to check for that
>> I'm not sure how to play classical on spotify
What does ps aux | grep librespot show? Does the user/pass parameters exist there?
Edit: Oh and did the skill keep it's user/pass settings?
librespot
process args retained the login info, and yes it is running/home/pi/.config/mycroft/skills/mycroft-spotify.forslund/settings.jsonson
DID have my retained user/pass too (which is why i thought it would be working)when I updated the account skills, logs show:
14:00:47.045 | INFO | 638 | mycroft.skills.mycroft_skill.mycroft_skill:handle_settings_change:308 | Updating settings for skill SpotifySkill
~~~~ | 638 | mycroft.skills.settings:save_settings:111 | Skill settings successfully saved to /home/pi/.config/mycroft/skills/mycroft-spotify.forslund/settings.json
Removing event mycroft-spotify.forslund:SpotifyLogin
, no seeming difference though to /home/pi/.config/mycroft/skills/mycroft-spotify.forslund/settings.jsonson
...
retesting:
list spotify devices DEBUG output
>> There are no Spotify devices available. skills.log, other
Going back to managed ...
(.venv) pi@picroft:~/mycroft-core/skills/mycroft-spotify.forslund $ git checkout origin/new-managed
Note: checking out 'origin/new-managed'.
13:58:25.100 | INFO | 638 | mycroft.skills.skill_loader:reload:108 | ATTEMPTING TO RELOAD SKILL: mycroft-spotify.forslund
Removing event mycroft-spotify.forslund:SpotifyLogin
Removing event mycroft-spotify.forslund:MonitorSpotify
13:58:25.181 | INFO | 638 | mycroft.skills.skill_loader:_execute_instance_shutdown:146 | Skill mycroft-spotify.forslund shut down successfully
13:58:25.342 | INFO | 638 | mycroft.skills.settings:get_local_settings:78 | /home/pi/.config/mycroft/skills/mycroft-spotify.forslund/settings.json
Removing event mycroft-spotify.forslund:SpotifyLogin
Removing event mycroft-spotify.forslund:SpotifyLogin
13:58:30.033 | ERROR | 638 | SpotifySkill | librespot failed to start.
THEN disabled librespot (I guess did this in wrong order)
(.venv) pi@picroft:~/mycroft-core/skills/mycroft-spotify.forslund $ sudo systemctl disable raspotify
Removed /etc/systemd/system/multi-user.target.wants/raspotify.service.
(.venv) pi@picroft:~/mycroft-core/skills/mycroft-spotify.forslund $ sudo systemctl stop raspotify
mycroft had no change in the logs;
rechecking the state;
(.venv) pi@picroft:~/mycroft-core/skills/mycroft-spotify.forslund $ ps aux | grep librespot
pi 7606 0.0 0.0 7348 476 pts/1 S+ 14:03 0:00 grep --color=auto librespot
(.venv) pi@picroft:~/mycroft-core/skills/mycroft-spotify.forslund $ cat /home/pi/.config/mycroft/skills/mycroft-spotify.forslund/settings.json
{"__mycroft_skill_firstrun": false, "user": "SNIP", "Spotify": 1, "password": "SNIP", "use_ducking": true, "default_device": ""}
, librespot isn't running (makes sense at this moment), and the cached skills are still there
as we've seen though, the account skills page was wiped ;/ https://account.mycroft.ai/skills - FIXED again
13:58:36.294 | INFO | 638 | mycroft.skills.skill_manager:send:64 | New Settings meta to upload.
~~~~ycroft.skills.settings:_emit_settings_change_events:411 | Emitting skill.settings.change event for skill @8fd6a191-0c8d-431e-89fd-7637c1297f9b|mycroft-spotify|20.02
14:03:10.276 | INFO | 638 | mycroft.skills.mycroft_skill.mycroft_skill:handle_settings_change:308 | Updating settings for skill SpotifySkill
~~~~ | 638 | mycroft.skills.settings:save_settings:111 | Skill settings successfully saved to /home/pi/.config/mycroft/skills/mycroft-spotify.forslund/settings.json
Removing event mycroft-spotify.forslund:SpotifyLogin
14:03:13.300 | ERROR | 638 | SpotifySkill | librespot failed to start.
hmmm, not sure why librespot is failing to start
rebooted the mycroft shutdown -r now
,
14:06:00.492 | INFO | 633 | mycroft.skills.skill_loader:load:114 | ATTEMPTING TO LOAD SKILL: mycroft-spotify.forslund
14:06:00.555 | INFO | 633 | mycroft.skills.settings:get_local_settings:78 | /home/pi/.config/mycroft/skills/mycroft-spotify.forslund/settings.json
Removing event mycroft-spotify.forslund:SpotifyLogin
14:06:00.863 | INFO | 633 | mycroft.skills.skill_loader:_communicate_load_status:280 | Skill mycroft-spotify.forslund loaded successfully
OMG after reboot the account settings are lost again :haircut_man: FIXED again ... ffs
cat /home/pi/.config/mycroft/skills/mycroft-spotify.forslund/settings.json
{"__mycroft_skill_firstrun": false, "user": "SNIP", "Spotify": 1, "password": "SNIP", "use_ducking": true, "default_device": ""}
ugh still
14:08:22.129 | ERROR | 633 | SpotifySkill | librespot failed to start.
Sorry for the late reply, did you get the skill to start librespot again? Or is it still failing?
Sorry for the late reply, did you get the skill to start librespot again? Or is it still failing?
hey @forslund ; it is OK :) - I have not gotten it to work; (in fact is in the same state, and the sad state of not being able to voice activate spotify)
EDIT: hit me up on the mycroft mattermost and maybe we can more effectively work through next steps / troubleshooting?
UPDATE: we worked through various issues; identified USER ERRORS - forslund is tracking various "troubleshooting/usability" improvements that will come out of this in order to allow users to "help themselves" a bit more easily
A couple of thoughts / ideas from the issues here:
Hey @forslund ; just this weekend finished transitioning from a Mycroft Linux x86 install on an older piece of hardware; to a raspberry pi 3B+; on the previous system, spotify was working well enough; (but for a few issues which we initially worked through) - in the end I had remote device working, without local playback (even w/ librespot installed)
--
now with the pi, I think I went through similar installation steps, spotify skills looks OAauth'd and connected through the skills account settings;
I also installed https://dtcooper.github.io/raspotify/;
Have left it overnight, and rebooted the picroft a few times, but still:
any recommendation for debug/etc? (whatever I figure out I'll contribute/fix if I can )