Kodi Community Forum

Full Version: Squeezebox for Kodi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Squeezebox for Kodi

Transform Kodi in a Squeezebox player with this addon.
It started as something for my own personal use but I figured with a few additional touches it can be usefull to others too.

Altough Logitech stopped producing the Squeezeboxes several years ago, the platform is still very popular and in active development by the opensource community. Sure, systems like Sonos and Heos might be superior in ease of use but they're also (in my opinion) very expensive. I wanted to have a way to have multi-room music with an ocassional need of syncing audio between players using my existing components such as Kodi Intel NUC's and raspberry pi's, including support of my Hi-Def audio tracks on disk and my Spotify playlists.

The Squeezebox setup with the Logitech Media Server is perfectly capable of doing all that, including support for a wide range of other devices in the mix such as Airplay devices. You can have a combination of original squeezeboxes, pc's with Squeezelite (software player for Squeezebox), Airplay devices and even Chromecast devices and let them all play your favorite tunes. There are even some nice projects available to turn a Raspberry Pi into a squeezebox like PiCoreAudio and Max2Play.

For all additional rooms such as kitchen, outside and my office, I use headless Pi's with PiCoreAudio connected to some actve speakers.
Offcourse in for example the living room I have Kodi running as my all-in-one media solution and I didn't want to add another box in there just to play audio.
That's where Squeezelite comes in play, a nice piece of software that you can install on about any platform to make it play the sounds from the Squeezebox server (Logitech Media Server).

Squeezelite on it's own does it's job very great and you can install it side to side with Kodi on your setup but I was missing the interaction with kodi. Especially the "Now Playing" screen so I can watch some artwork and artist info while track are playing. That's when I decided to create something to fill that gap so I could have the benefits of the centralized audio control of LMS combined with the great Kodi software.

I realize there's already an addon for Kodi, named Xsqueeze but it's rather outdated and it's based on custom dialogs which is something I didn't want (personal taste, the Xsqueeze addon is other than that great software offcourse).

So, how does this work ? At first I tried to feed Kodi with the audiostream directly from the Squeezeserver by using the Squeezelite source but I finally gave up on that as I couldn't get it stable enough, especially when sync comes in play. Offcourse doable maybe somewhere in the future but it will require a fair amount of work and tight integration into the Kodi source code.

To have something ready sooner I had the idea to just "trick" Kodi that it's playing something and instead use the default, well known and well working Squeezelite software to handle the playback directly to the sound device.

And that is exactly what this add-on does, it feeds Kodi with a 100% silent PCM audio stream so that the "Now Playing" screen will show up whenever Squeezelite is pumping audio to the speakers. It's basically just one big workaround but it works pretty great. As soon as you start Kodi, this addon will auto start Squeezelite in the background and it will poll the server for changes every second. Everything is supported like playlist handling, skipping tracks, pause, stop, syncing etc.


- Auto start Squeezelite in the background (can be disabled in the addon settings if you start squeezelite yourself, for example on Max2Play devices).
- Registers as a sqeezeplayer in the LMS server with the MAC address that is reported by Kodi.
- Auto detects the LMS server in the network and connects to the first instance it finds.
- Auto detects the default (ALSA) sound device and use that for audio playback.
- Plugin entry (audio addon) to browse your media on the LMS server, including apps like Spotify etc.
- Because the plugin entry you can use native Kodi library windows to navigate your media, including creation of widgets etc.
- Supports Windows, MacOS, Linux x86/x64, Libreelec (possibly also Raspbmc but I didn't test it)
- Supports Android if you install a Squeezebox player app (like SB Player)
- Supports iOS if you install a Squeezebox player app (like iPeng)
- Primary acts as both a player and a controller but can also be set to acts as controlled for another player. In that case set the addon settings to not start squeezelite and configure the Mac address manually. This is also used on Android where SB Player (or other) is actually playing the audio.

Instructions / Notes

- Install this add-on from my Kodi addon repository, that way all dependencies will be installed and you will get updates instantly. Please do not install directly from Github if you want to ask support on the forums.
- Libreelec users: Make sure you have the mediatools addon installed as that includes Squeezelite !
- You need to have a LMS Server on your network, for example installed on your NAS.
- This addon only utilizes the more recent Json API of LMS-Server, the older telnet API is not used, so you need a recent version of the LMS server. I've tested it with LMS server version 7.9 myself.
- Make sure the LMS server doesn't require authentication for internal connections. I did not yet implement support for authentication.
- I have tested the addon on Windows, MacOS and libreelec running on a Pi. Remember, this considered beta software. Altough I spent a fair amount of optimizing it and it works in my scenario, bugs can happen. In that case, or if you have a request to improve it, feel free to let me know on the forums. In case of asking for support when an issue arrises, please include as much info as possible about your setup including the error message in the Kodi log or the entire Kodi logfile itself. Also, Pull requests on Github to optimize the addon are always welcome, feel free to contribute!

TODO/On my wishlist
- Integrate with my Spotify addon so you can use the Spotify app to interact with the LMS-server
- Add "Play with LMS" contextmenu options to play any media in Kodi through the LMS-server (e.g. for synced audio in multiple rooms)

I hope this addon brings some joy to others too, have fun!

To install, grab the addon from my Kodi repository:
Great! I'd love to retire XSqueeze quite honestly....

It's shame this stlll isn't an actual implementiation of squeezebox player but I can see why you took the toure you did (as did I many moons ago...). But one would need solid c++ skills to that properly...

I installed it and tried to give it a go, but hit a few issues...It found my server etc fine, but the first time I picked an album to play it started squeezelite (in win 10 task manager I could see it) - but no audio (also nothing in log that looked like an issue. Tried again (note the new music view seems to just return my entire collection, not the LMS new music stuff).

This time got some music but the addon bailed with

                                            Error Type: <type 'exceptions.ValueError'>
                                            Error Contents: invalid literal for int() with base 10: '105.965'
                                            Traceback (most recent call last):
                                              File "C:\XBMC\Krypton\Kodi\portable_data\addons\plugin.audio.squeezebox\service.py", line 13, in <module>
                                              File "C:\XBMC\Krypton\Kodi\portable_data\addons\plugin.audio.squeezebox\resources\lib\main_service.py", line 85, in __init__
                                                self.monitor_lms(kodiplayer, lmsserver)
                                              File "C:\XBMC\Krypton\Kodi\portable_data\addons\plugin.audio.squeezebox\resources\lib\main_service.py", line 124, in monitor_lms
                                              File "C:\XBMC\Krypton\Kodi\portable_data\addons\plugin.audio.squeezebox\resources\lib\player_monitor.py", line 137, in update_playlist
                                                li, file_name = self.create_listitem(item)
                                              File "C:\XBMC\Krypton\Kodi\portable_data\addons\plugin.audio.squeezebox\resources\lib\player_monitor.py", line 121, in create_listitem
                                                file_name = "" % (self.webport, "%s" % int(lms_song.get("duration")))
                                            ValueError: invalid literal for int() with base 10: '105.965'
                                            -->End of Python script error report<--

I had to kill Kodi, then the two external players that were still running, to get back on track.

I only got cover art when actually in an album view - but maybe I didn't give it long enough to go get it? Didn't seem to be coming up, jsut radio symbols everywhere.

...anyway certainly looks on its way and a better more modern solution, and jsut a quick play. I will follow along & great someone has taken the time to come up with a better solution at last! XSqueeze was never really intended to be anything other than a python learning exercise and a quick demo...
Interested in following along in this as well. I use xsqueeze currently and it works quite well to manage my squeezlite install that runs in startup. Only drawback is as you noted lack of tighter integration with the now playing.

Question: will this work with visualizations such as milkdrop 2 Kodi add-on? I was just looking for a way to trick kodi to thinking something is playing...

Sent from my XT1254
Given squeezelite is still lthe playback engine, no visualiser that responds to the audio stream will work with it I'd say. It will start, sure, but all it would think is you're playing silence all the time.
@bossanova808 Thanks for testing the addon!
I have just placed a new version on the repo which should fix the issues you reported

@skarragallagher: Indeed it's just like bossanova808 said, visualizations will not work. Well, they will work but they'll just do some random effects and not specifically reacting on the music because Kodi is just playing silence.
This sounds interesting. I dealt with the "now playing integration" point in a different way and just created a different screen entirely: http://forum.kodi.tv/showthread.php?tid=307961

Just me cheating/being lazy really...
(2017-05-08, 13:49)el_Paraguayo Wrote: [ -> ]This sounds interesting. I dealt with the "now playing integration" point in a different way and just created a different screen entirely: http://forum.kodi.tv/showthread.php?tid=307961

Just me cheating/being lazy really...

Sorry, didn't realize there was actually more development besides Xsqueeze...
I like what you did with the custom playing screen but I like to use the native Kodi controls so that's why I created this project.
Feel free to test/use it/not use it or maybe even contribute some ideas or code.
After installing this addon I am not able to access any configuration dialog. When I install your Spotify addon I do see the configure dialog. I basically want to control a squeezelite that is already installed. This seems to give no option to do this.
I should note that it did seem to work by creating a second squeeze lite instance and I was able to navigate around and seemed to interact with playlists.
here is a screenshot of the dialog for squeezelite player

This shows no settings

Here is a screenshot of your spotify

I also tried using estuary skin end restarting kodi, along with trying it a complete other kodi instance. No settings dialog
(2017-05-09, 23:02)skarragallagher Wrote: [ -> ]I also tried using estuary skin end restarting kodi, along with trying it a complete other kodi instance. No settings dialog

Forgot to check in a file on Git. New version will be on the repo in a few minutes..
Nice, let me know when and I'll update

Sent from my XT1254
(2017-05-09, 23:08)skarragallagher Wrote: [ -> ]Nice, let me know when and I'll update

Sent from my XT1254 (typie typie)

It should be available by now, please give it a try and let me know.
Okay, now we are cooking. I will install this my 2 kodi instances
(2017-05-09, 23:46)skarragallagher Wrote: [ -> ]Okay, now we are cooking. I will install this my 2 kodi instances

OK great. Please give it a good testdrive and let me know. It works pretty well on my setups but I don't know if it's also the case for others
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19