[Music] Squeeze box / Logitech Media Server control

Ahh home.mycroft.ai not updating reliably. My old nemesis. I touched the setting again and bounced the skills service and it like it started correctly. I see some other errors now, but I won’t have more time to test it tonight.
I have a fairly large collection which you mention as a caution in the readme, so I wonder if that could be related to the latest note. I’ll play with it some more tomorrow. It may be working now, but I can’t say for sure.

00:11:18.850 - skill-squeezebox_johanpalmqvist:initialize:24 - INFO - Initializing SqueezeBox Media skill
00:11:18.854 - mycroft.skills.padatious_service:_register_object:113 - DEBUG - Registering Padatious intent: skill-squeezebox.johanpalmqvist:VolumeUnmute.intent
00:11:18.862 - skill-squeezebox_johanpalmqvist:initialize:43 - DEBUG - Speak dialog enabled: False
00:11:18.868 - skill-squeezebox_johanpalmqvist:get_sources:59 - INFO - Loading content
00:11:18.871 - skill-squeezebox_johanpalmqvist:get_sources:61 - DEBUG - Selecting default backend
00:11:18.876 - skill-squeezebox_johanpalmqvist:get_playerid:109 - DEBUG - Requested backend: Kitchen
00:11:18.888 - mycroft.skills.padatious_service:_register_object:113 - DEBUG - Registering Padatious intent: skill-squeezebox.johanpalmqvist:VolumeUp.intent
<players redacted>
    00:11:20.873 - skill-squeezebox_johanpalmqvist:get_playerid:127 - DEBUG - Player confidence: 1.0
    00:11:20.876 - skill-squeezebox_johanpalmqvist:get_playerid:130 - DEBUG - Extracted backend: Kitchen
    00:11:20.913 - skill-squeezebox_johanpalmqvist:load_library_total_duration:167 - INFO - Loading library total duration state
    00:11:20.921 - skill-squeezebox_johanpalmqvist:load_library_total_duration:173 - INFO - Loaded library total duration state
    00:11:20.932 - skill-squeezebox_johanpalmqvist:update_sources_cache:347 - INFO - Library total duration changed. Updating cache.
    00:11:20.966 - skill-squeezebox_johanpalmqvist:load_library_total_duration:167 - INFO - Loading library total duration state
    00:11:20.976 - skill-squeezebox_johanpalmqvist:load_library_total_duration:173 - INFO - Loaded library total duration state
    00:11:20.982 - skill-squeezebox_johanpalmqvist:update_library_cache:324 - INFO - Library total duration unchanged. Not updating cache.
    00:11:20.986 - skill-squeezebox_johanpalmqvist:load_library_cache:157 - INFO - Loading library cache
    00:11:20.990 - skill-squeezebox_johanpalmqvist:load_library_cache:163 - ERROR - Library cache not found. Exception: Expecting value: line 1 column 1 (char 0)
    00:11:21.014 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist.set'
    00:11:21.022 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:IdentifyTrack.intent'
    00:11:21.025 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:Stop.intent'
    00:11:21.029 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:UpdateCache.intent'
    00:11:21.032 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeDown.intent'
    00:11:21.035 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeHalf.intent'
    00:11:21.038 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeMax.intent'
    00:11:21.042 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeMute.intent'
    00:11:21.045 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeQuarter.intent'
    00:11:21.048 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeThreeQuarters.intent'
    00:11:21.053 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeUnmute.intent'
    00:11:21.056 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeUp.intent'
    00:11:21.173 - mycroft.skills.core:load_skill:166 - ERROR - Failed to load skill: skill-squeezebox.johanpalmqvist
      File "/opt/mycroft/skills/skill-squeezebox.johanpalmqvist/__init__.py", line 55, in initialize
      File "/opt/mycroft/skills/skill-squeezebox.johanpalmqvist/__init__.py", line 65, in get_sources
      File "/opt/mycroft/skills/skill-squeezebox.johanpalmqvist/__init__.py", line 348, in update_sources_cache
      File "/opt/mycroft/skills/skill-squeezebox.johanpalmqvist/__init__.py", line 234, in save_sources_cache
    AttributeError: 'SqueezeBoxMediaSkill' object has no attribute 'results'

OK it appears to be caching the albums so everything appears to be progressing. I’ll give it a go once that finishes.

One error buried in the logs is:
Failed to load setting file: /opt/mycroft/skills/skill-squeezebox.johanpalmqvist/settingsmeta.json which looks fine. It doesn’t have my settings there, but has the template.

Thanks for everything, this has been one of my most wanted items in Mycroft for a long time!

1 Like

OK it was able to scan through all my music (I think) the final scans were of genre, but the skill won’t load with the following error:

17:46:26.961 - mycroft.skills.core:load_skill:166 - ERROR - Failed to load skill: skill-squeezebox.johanpalmqvist
  File "/opt/mycroft/skills/skill-squeezebox.johanpalmqvist/__init__.py", line 55, in initialize
  File "/opt/mycroft/skills/skill-squeezebox.johanpalmqvist/__init__.py", line 65, in get_sources
  File "/opt/mycroft/skills/skill-squeezebox.johanpalmqvist/__init__.py", line 348, in update_sources_cache
  File "/opt/mycroft/skills/skill-squeezebox.johanpalmqvist/__init__.py", line 296, in save_sources_cache

Re-reading your readme (duh) I’m guessing this may be insurmountable, due to the size of the library.

I’m OK with a skill which would be limited to turning the players on and off and favorites/radio stations, as I can navigate the music in other ways. Would it be possible to create a setting which just scanned favorites or radio stations?

Could the issue be caused by missing genre tags in your media files? I’m not sure how large a library can be before running into issues due to size but the library sources are stored in RAM for faster access. I’ve pushed a new version with more error handling and added configurable sources which makes it possible to just load favorites (or other combinations). Would be interesting to see if you still run into issues with the media library on the latest version (might have to delete the *.json.gz files in the skill folder first to make sure they’re recreated).

Awesome! Thanks so much. I’ll test it out tomorrow and I’m going to post it, unless you want to, on the Slimserver forums https://forums.slimdevices.com/forum.php and maybe we can get some more testers.

@JOPS I was able to remove the media library setting and the skill works! Thank you so much this is great.

As for the library itself. There could easily be junk in the tags (especially genre), but I typically navigate my library via dynamic playlists and favorites so this is good enough. Maybe once I clean up the tags I can retry scanning it again.

Is there a command to just turn on/off a player? I typically sync all my players so I don’t need to play something on them just turn one on or off.

I did notice if it can’t find something in its searching it does say you don’t have a music skill installed. I will play around some more and report back.

Thanks for all your work on this!!!

1 Like

@sanderant: You’re welcome, and thank you very much for the testing and feedback!

With the latest version you should be able to power on/off a player. Never used that feature myself but it was easy to add it to the skill.

The response you get sometimes about not having any music skills installed comes from skill-playback-control which handles CommonPlay so you might want to open an issue there. I’ve gotten it too a few times and guess it responds that way when a music skill either doesn’t find a match or it takes too long to deliver a matching result. Maybe the timeout value could be adjusted in skill-playback-control to mitigate the issue but I also think the wording of the response could be better since a music skill is actually installed.

Feel free to mention what Mycroft can do with this skill in the Slimserver forums since I don’t (yet) have an account there (nor have I ever owned any real Squeezebox hardware, only RPi3 + HiFiBerry).

I’m a long-time LMS user, and I picked up on this skill a few days ago via @sanderant post on the Squeezebox forums. I repurposed a Pi3+ with a Jabra borrowed from work and had some fun getting it all to work, at least with some of the standard skills.

I have installed your Squeezebox skill, and configured it with details of my LMS server and main player. But I just can’t see how to use the skill (I am new to this Mycroft/Picroft thing) - or even check whether it’s functioning, so any pointers would be helpful. For example, where do I find the various logs that I could use to identify the issues? And even, what are the commands to ask Mycroft to play from LMS?

Robert

1 Like

Hey @GrumpyBob the best thing is to check the skills log. The process can be a little frustrating to be sure, but if you can grep the skills log that is where I found the most help.

grep -i squeeze /var/log/mycroft/skills.log | less

2 Likes

Hi JOPS & others
Thank you for the skill!! This would be phenomenal if I could get it to work, but it doesn’t :frowning:
Each time I get following error. Tried to change some things in code, Pi can ping the server and all, so I don’t know where to look from here. (I added the settings debuglog also to the errorlog to make it easier to verify)

20:41:02.073 - mycroft.skills.core:load_skill:123 - INFO - ATTEMPTING TO LOAD SKILL: skill-squeezebox with ID skill-squeezebox
20:41:03.704 - mycroft.skills.settings:_poll_skill_settings:412 - INFO - SqueezeBox Media Skill: Delaying next settings fetch
20:41:04.019 - skill-squeezebox:initialize:24 - INFO - Initializing SqueezeBox Media skill
20:41:04.048 - skill-squeezebox:initialize:33 - ERROR - Settings: {'server': '<IPADDRESS>', 'speak_dialog_enabled': False, 'default_player_name': 'Squeezebox_Radio', 'media_library_source_enabled': True, 'playlist_source_enabled': True, 'podcast_source_enabled': True, 'username': '', 'port': '<PORTOFWEBCLIENT', 'password': '', 'favorite_source_enabled': True}
20:41:04.060 - skill-squeezebox:get_sources:94 - INFO - Loading content
20:41:04.301 - skill-squeezebox:load_library_total_duration:241 - INFO - Loading library total duration state
20:41:04.307 - skill-squeezebox:load_library_total_duration:247 - INFO - Loaded library total duration state
20:41:04.312 - skill-squeezebox:update_sources_cache:444 - INFO - Library total duration changed. Updating cache.
20:41:04.358 - skill-squeezebox:load_library_total_duration:241 - INFO - Loading library total duration state
20:41:04.364 - skill-squeezebox:load_library_total_duration:247 - INFO - Loaded library total duration state
20:41:04.371 - skill-squeezebox:update_library_cache:421 - INFO - Library total duration unchanged. Not updating cache.
20:41:04.381 - skill-squeezebox:load_library_cache:231 - INFO - Loading library cache
20:41:04.389 - skill-squeezebox:load_library_cache:237 - ERROR - Library cache not found. Exception: Expecting value: line 1 column 1 (char 0)
20:41:04.616 - mycroft.skills.core:load_skill:170 - ERROR - Failed to load skill: skill-squeezebox
  File "/opt/mycroft/skills/skill-squeezebox/__init__.py", line 80, in initialize
  File "/opt/mycroft/skills/skill-squeezebox/__init__.py", line 101, in get_sources
  File "/opt/mycroft/skills/skill-squeezebox/__init__.py", line 445, in update_sources_cache
  File "/opt/mycroft/skills/skill-squeezebox/__init__.py", line 308, in save_sources_cache
AttributeError: 'SqueezeBoxMediaSkill' object has no attribute 'results'

Hi all

I am quite new to Mycroft and still learning so be kind if I ask something stupid.

Anyway I installed it on a Google AIY kit to test and it all works well. Then I discovered the Squeeze box skill which I have installed.
(.venv) pi@picroft:~ $ mycroft-msm list|grep squee

INFO - building SkillEntry objects for all skills
INFO - building SkillEntry objects for all skills
INFO - invalidating skills cache
skill-squeezebox.johanpalmqvist	[installed]

Problem is that I can’t work out how to configure it. If I go to the mycroft.ai page it is not listed in the list of skil.
Am I supposed to populate the setting.json file myself? if so what is the format?

Thank for you help.

Hi ppmt,

Not a stupid question at all, I just downloaded the Skill and had the same issue.

I’ve submitted a fix back to Johan the original author but if you want to get going straight away you can replace this file:
/opt/mycroft/skills/skill-squeezebox.johanpalmqvist/__init__.py
with my updated version:
https://raw.githubusercontent.com/krisgesling/skill-squeezebox/fix/get-settings/__init__.py

@gez-mycroft

I tried to download your file but it is the same file as the one I have

-rw-r--r--  1 pi pi 42828 Dec 19 15:24 __init__.py
-rw-r--r--  1 pi pi 42828 Dec  9 13:25 __init__.py.org

cksum is the same as well

edit: I found your file in the main repository. And now I can see it in the mycroft.ai

Thanks. Now I need to figure out how to use it

Sorry wrong link:
https://raw.githubusercontent.com/krisgesling/skill-squeezebox/fix/get-settings/__init__.py

1 Like

I got it to work so thanks a lot for that @gez-mycroft

1 Like

Anyone here still using the squeezebox skill with mycroft? I just started to use picroft and installed te skill successfully but cannot configure it. Even after the exchanging the init.py, the skill is not shown at Account and I am struggling to set the setting file manually.

I have not, but just put it on my TODO list. I’ve been having issues with Emby/Jellyfin. I will report back …

-Mike M

I was actually able to solve it! After a fresh Picroft installation with the latest release candidate (https://mycroft.ai/to/picroft-rc), the Squeezebox skill config page is now available.

Sorry for necromancing an old thread, but it seems not too many people are using Mycroft together with LMS (Logitech Media Server, aka SqueezeboxServer aka Slimserver), albeit this is a great solution.

I use LMS v8.2.1 (on an Ubuntu machine) with about 10 players (some hardware, some Squeezelite), and a library of about 153,000 titles. My Mycroft is currently a test installation on my Linux Mint 20.3/Cinnamon laptop, version 21.2.2, and I’ve installed the skill-squeezebox by git cloning it into my /opt/mycroft/skills folder.

My initial setup problem was the LMS host name on my account’s skill setup page: I had to use studio1 as my host name, not studio1.local or studio1.fritz.box, because the latter two would produce AttributeError: 'SqueezeBoxMediaSkill' object has no attribute 'lms'. (I almost never use fixed IP addresses—we do have DHCP and DNS, after all!)

After having this fixed, the skill managed to get to the total library duration (/opt/mycroft/skills/skill-squeezebox/library_total_duration_state.json.gz), song list (/opt/mycroft/skills/skill-squeezebox/library_cache.json.gz) and album list (/opt/mycroft/skills/skill-squeezebox/sources_cache.json.gz) from my LMS. As far as I can manually check, these look okay, even for the “odd” titles using fancy UTF-8 filenames (like Bowie’s “star” album, or Chinese/Japanese songs).

My current problem is now that, upon spoken (or typed) input like

  • play electronic music
  • play artist acdc (AC/DC, but it seems able to resolve that!)
  • play thunderstruck
  • play thunderstruck by acdc
  • play album let’s rock (by The Black Keys)

the skill comes up with error AttributeError: 'SqueezeBoxMediaSkill' object has no attribute 'default_player_name'. It should know this, I entered it on my account’s skill settings page (tried both a hardware player Wohnzimmer and a Squeezelite player e6510), and it also has the info in /home/matthias/.config/mycroft/skills/skill-squeezebox/settings.json:

{"__mycroft_skill_firstrun": false, "port": "9000", "server": "studio1", "password": "", "username": "", "default_player_name": "e6510", "speak_dialog_enabled": false, "podcast_source_enabled": true, "favorite_source_enabled": true, "playlist_source_enabled": true, "media_library_source_enabled": true}

The error message in Mycroft is:

 10:08:50.183 | ERROR    | 39566 | mycroft.skills.mycroft_skill.mycroft_skill:on_error:923 | An error occurred while processing a request in Squeeze Box Media Skill
Traceback (most recent call last):
  File "/home/matthias/Projekte/mycroft-core/mycroft/skills/mycroft_skill/event_container.py", line 73, in wrapper
    handler(message)
  File "/home/matthias/Projekte/mycroft-core/mycroft/skills/common_play_skill.py", line 97, in __handle_play_query
    result = self.CPS_match_query_phrase(search_phrase)
  File "/opt/mycroft/skills/skill-squeezebox/__init__.py", line 617, in CPS_match_query_phrase
    backend, playerid = self.get_playerid(self.get_backend(phrase))
  File "/opt/mycroft/skills/skill-squeezebox/__init__.py", line 184, in get_playerid
    backend = self.default_player_name.title()
AttributeError: 'SqueezeBoxMediaSkill' object has no attribute 'default_player_name'
 10:08:55.361 | INFO     | 39566 | Playback Control Skill |    No matches

For the life of me, I can’t find out what the reason might be. Anyone who can help me debug or has an idea? I’d so much like to have Mycroft interact with my LMS!

Interesting also: If I try to specify a different player by saying play album let's rock on player Wohnzimmer, it also now brings up an AttributeError: 'SqueezeBoxMediaSkill' object has no attribute 'lms', although it could previously use lms to read the library:

 10:21:14.635 | INFO     | 39566 | Playback Control Skill | Resolving Player for: album let's rock on player Wohnzimmer
 10:21:16.969 | ERROR    | 39566 | mycroft.skills.mycroft_skill.mycroft_skill:on_error:923 | An error occurred while processing a request in Squeeze Box Media Skill
Traceback (most recent call last):
  File "/home/matthias/Projekte/mycroft-core/mycroft/skills/mycroft_skill/event_container.py", line 73, in wrapper
    handler(message)
  File "/home/matthias/Projekte/mycroft-core/mycroft/skills/common_play_skill.py", line 97, in __handle_play_query
    result = self.CPS_match_query_phrase(search_phrase)
  File "/opt/mycroft/skills/skill-squeezebox/__init__.py", line 617, in CPS_match_query_phrase
    backend, playerid = self.get_playerid(self.get_backend(phrase))
  File "/opt/mycroft/skills/skill-squeezebox/__init__.py", line 186, in get_playerid
    players = self.lms.get_players()
AttributeError: 'SqueezeBoxMediaSkill' object has no attribute 'lms'
 10:21:22.347 | INFO     | 39566 | Playback Control Skill |    No matches

I wonder if this might be some Python and/or threading problem… (I run Linux Mint 20.3 and Python 3.8.10 on this laptop, Intel Core i7 Q740 [4 cores/8 threads], 16 GB RAM, 1 TB SSD).

I believe you have to setup and connect with a Username and Password on LMS. That is what worked for me. I can now use voice commands to play genres and artists but it doesn’t seem to be loading playlists even though it recognizes the command.