Squeezebox for Kodi

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
marcelveldt Offline
Skilled Skinner
Posts: 7,959
Joined: Jul 2014
Reputation: 318
Location: The Netherlands
Post: #1
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.

Features

- 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:
https://github.com/marcelveldt/repositor...-1.0.1.zip
(This post was last modified: 2017-05-07 21:42 by marcelveldt.)
find quote
bossanova808 Offline
Donor
Posts: 2,838
Joined: Sep 2009
Reputation: 56
Location: Melbourne, Australia
Post: #2
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

Code:
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            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>
                                                MainService()
                                              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
                                                kodiplayer.update_playlist()
                                              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 = "http://127.0.0.1:%s/track/%s" % (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...

Sorry, no help w/out a *full debug log*
find quote
skarragallagher Offline
Senior Member
Posts: 248
Joined: Aug 2015
Reputation: 0
Post: #3
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 (typie typie)
find quote
bossanova808 Offline
Donor
Posts: 2,838
Joined: Sep 2009
Reputation: 56
Location: Melbourne, Australia
Post: #4
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.

Sorry, no help w/out a *full debug log*
find quote
marcelveldt Offline
Skilled Skinner
Posts: 7,959
Joined: Jul 2014
Reputation: 318
Location: The Netherlands
Post: #5
@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.
find quote
el_Paraguayo Offline
Donor
Posts: 1,060
Joined: Feb 2011
Reputation: 28
Location: London, UK
Post: #6
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...

BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
find quote
marcelveldt Offline
Skilled Skinner
Posts: 7,959
Joined: Jul 2014
Reputation: 318
Location: The Netherlands
Post: #7
(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.
find quote
skarragallagher Offline
Senior Member
Posts: 248
Joined: Aug 2015
Reputation: 0
Post: #8
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.
(This post was last modified: 2017-05-09 22:46 by skarragallagher.)
find quote
skarragallagher Offline
Senior Member
Posts: 248
Joined: Aug 2015
Reputation: 0
Post: #9
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.
find quote
skarragallagher Offline
Senior Member
Posts: 248
Joined: Aug 2015
Reputation: 0
Post: #10
here is a screenshot of the dialog for squeezelite player
[Image: OOIf68j.png]

This shows no settings
[Image: ezYbXD7.png]

Here is a screenshot of your spotify
[Image: rS66LG5.png]

I also tried using estuary skin end restarting kodi, along with trying it a complete other kodi instance. No settings dialog
(This post was last modified: 2017-05-09 23:03 by skarragallagher.)
find quote
marcelveldt Offline
Skilled Skinner
Posts: 7,959
Joined: Jul 2014
Reputation: 318
Location: The Netherlands
Post: #11
(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..
find quote
skarragallagher Offline
Senior Member
Posts: 248
Joined: Aug 2015
Reputation: 0
Post: #12
Nice, let me know when and I'll update

Sent from my XT1254 (typie typie)
find quote
marcelveldt Offline
Skilled Skinner
Posts: 7,959
Joined: Jul 2014
Reputation: 318
Location: The Netherlands
Post: #13
(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.
find quote
skarragallagher Offline
Senior Member
Posts: 248
Joined: Aug 2015
Reputation: 0
Post: #14
Okay, now we are cooking. I will install this my 2 kodi instances
(This post was last modified: 2017-05-09 23:46 by skarragallagher.)
find quote
marcelveldt Offline
Skilled Skinner
Posts: 7,959
Joined: Jul 2014
Reputation: 318
Location: The Netherlands
Post: #15
(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
find quote
Post Reply