[Music] Squeeze box / Logitech Media Server control

Basic voice control of LMS squeezebox or squeezeplay media players on the network.
LMS is a local network media server and client system with an enthusiastic user base, who value local storage and control of their own digital libraries as opposed to offsite cloud storage or streaming. I can’t see how Mycroft would find a better fit with its own userbase.

Been using LMS for many years, would love to see a skill written for it. Might even have a crack at it myself after I get back from my travels.

great suggestion, @Steve_Chabot.

I don’t suppose I’d be asking too much if I got you to write this up using our template for Skill Suggestions? It helps us to spur discussion on what the Skill does, and also the Intents and Dialog it would use.


Skill name: something-meaningful-skill

User story:

As a (type of user) I want this Skill to have (function or feature) so that I can achieve (objective)
eg. As a music lover, I want this Skill to control my music player so I can have voice-enabled music on my Mycroft Device

What third party services, data sets or platforms will the Skill interact with?

Are there similar Mycroft Skills already?

See https://github.com/MycroftAI/mycroft-skills for a list. If so, how could they be combined?

What will the user Speak to trigger the Skill?

For example “What’s the weather like?” or “How much is the Canadian dollar worth right now?” or “Play Aussie Rock music”

What phrases will Mycroft Speak?

For example, “The weather is cloudy with a top of 60F”, “The Canadian dollar is worth 90 US cents”, “Now playing Aussie Rock on Spotify”

What Skill Settings will this Skill need to store?

See https://mycroft.ai/documentation/skills/skill-settings/ for more information

Other comments?

Put any other comments you think are relevant in here

I’d like to see this feature too so let me have a go at completing the skill suggestion template.


Skill name: mycroft-logitechmediaserver

User story:

  • As a Mycroft administrator, I want to configure my Mycroft installation with the network address of my Logitech Media Server (LMS) installation and details of (some of) its connected Music Players
  • As a music lover, I want to use Mycroft to pause and resume music on my Logitech Media Server Music Player(s)
  • As a music lover, I want to use Mycroft to select which music plays on each Music Player
  • As a music lover, I want to use Mycroft to control the volume on each Music Player

What third party services, data sets or platforms will the Skill interact with?

  • A Logitech Media Server installation, typically on the local network, accessed via the HTTP API on port 9000 or the CLI on port 9090.
  • Optionally also (or instead?) the mysqueezebox.com web site (does anybody rely on this without running a local LMS installation?)

Are there similar Mycroft Skills already?

  • spotify-skill
  • pianobar-skill
  • skill-playback-control
  • There’s a growing number of music sources / services - Spotify, Pandora, streaming services from Amazon | Google | Apple, files on a local NAS or similar repository etc. Rather than having a separate Skill for each of those, it would be really cool if there was a single “umbrella” music control Skill which had “plugins” to interface with the various different back-ends.

What will the user Speak to trigger the Skill?

  • [Similar - or even identical - commands to other music player Skills]
  • Play {{playlist_name}} | {{genre_name}} on {{player_name}}
  • Pause {{player_name}}
  • Resume {{player_name}}
  • Next track | Next song
  • Previous track | Previous song
  • [Some means of searching for music - see e.g. the Spotify skill]
  • [Some means of controlling the volume on different Players]

What phrases will Mycroft Speak?

  • [Confirmation of what has been requested - similar to other music player Skills]

What Skill Settings will this Skill need to store?

  • Hostname or IP address of the Logitech Media Server host
  • List of Player Names to be recognised by Mycroft, mapped to their unique IDs as used by LMS (MAC addresses)

Other comments?

  • In principle, it would be possible to host an LMS Player on the same device as is hosting Mycroft (e.g. using the Squeezelite player software). That’s not the only use case though; in fact users interested in this skill are likely to have existing LMS Players (often more than one) and are likely to be more interested in controlling those using Mycroft - at least initially.
  • It’s probably OK to assume that complex interactions like synchronising one player with another and setting alarms etc. will be done via the LMS web interface rather than using Mycroft - at least initially.
  • openHAB has an integration with Logitech Media Server (though it calls it by the old name - Squeezeboxserver). Might provide some implementation hints. See https://www.openhab.org/addons/bindings/squeezebox/

Currently doing local testing of a Squeezebox / Logitech Media Server skill I wrote some weeks ago for covering my own music player needs. It’s inspired by and similar to the other media playback skills and has most of the features I planned to implement initially. It supports volume and playback control of artists, albums, songs, genres, playlists, favorites (including radio channels saved as favorites) and latest podcast episodes (via podcasts app plugin). There’s still room for improvements and some things are a bit hardcoded for my setup but after some more testing, debugging and cleanup I intend to publish it to get help and feedback. The amount of time I can spend on the project is a bit limited right now so please be patient.

3 Likes

Sing out if you need a hand, @JOPS

That sounds super exciting! I am glad to pitch in if you need any help!

1 Like

@JOPS How’s that coming? Can you put up some code?

Hi all, Sorry for the long wait. I’ve experimented with and rewritten some parts of my Squeezebox skill to utilize the CommonPlay system (some new bugs have most likely been introduced in the process but I think it’s time to at least release something).

See https://github.com/johanpalmqvist/skill-squeezebox/ for the current code. You’re very welcome to test, give feedback and create pull requests. I will gladly accept any
help to get this into shape for the official Mycroft repositories.

3 Likes

Wow that’s fantastic. This has been on my wish list forever! Thank you so much!

I installed it and but I’m getting the response that no music services are installed. Does this require 19.02? I will create an issue on github.

Do you have any log files showing which skills Mycroft loaded during startup and are there any error messages?

In addition to this skill you also need the Playback Control skill for Common Play installed: https://github.com/MycroftAI/skill-playback-control/

So far I have only tested on 18.08 but I’ve started to upgrade my instances to 19.02.

OK I found the playback skill

pi@mark_1:~ $ msm list | grep playback
mycroft-playback-control        [installed]

I think this below from the skills log could be the problem. I did end upgrading to 19.02 to try that route which may be the problem.

20:44:45.805 - skill-squeezebox_johanpalmqvist:initialize:24 - INFO - Initializing SqueezeBox Media skill
20:44:45.840 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist.set'
20:44:45.849 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:IdentifyTrack.intent'
20:44:45.852 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:Stop.intent'
20:44:45.856 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:UpdateCache.intent'
20:44:45.859 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeDown.intent'
20:44:45.862 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeHalf.intent'
20:44:45.866 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeMax.intent'
20:44:45.869 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeMute.intent'
20:44:45.872 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeQuarter.intent'
20:44:45.876 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeThreeQuarters.intent'
20:44:45.879 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeUnmute.intent'
20:44:45.882 - mycroft.messagebus.client.ws:remove:159 - DEBUG - Removing found 'skill-squeezebox.johanpalmqvist:VolumeUp.intent'
20:44:45.999 - mycroft.skills.core:load_skill:166 - ERROR - Failed to load skill: skill-squeezebox.johanpalmqvist
  File "/opt/mycroft/skills/skill-squeezebox.johanpalmqvist/__init__.py", line 32, in initialize

I suspect it fails to load the settings. Did you go to https://home.mycroft.ai/ to configure the skill?

Regarding 19.02, I just upgraded my test instance and the skill is loading successfully but I haven’t tested it further at this point.

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).