Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Squeezebox Server (former SqueezeCenter)

Questions and comments specific to a particular plugin should go here.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Squeezebox Server (former SqueezeCenter)

Post by krambriw »

The functions "preset_x.hold"
It doesn't seem to work :(
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Squeezebox Server (former SqueezeCenter)

Post by piert »

krambriw wrote:Below are the available commands for "Button functions" in the CLI I'm using.
Hi Walter,

I would like to be able to set more than 9 internet radio presets, which I want to be able to call from Eventghost.
I believe it is possible to create a separate playlist for each radio station that you want as a preset and than call the playlist through a Command Line Interface, but I do not know how to make that work; do you know?

I think I read somewhere that it should be possible by using the command "playlist play <url>", but I don't know how to send that command. Does your plugin allow doing that somehow, or could it be created?
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Squeezebox Server (former SqueezeCenter)

Post by piert »

Nevermind, I think I have found the solution (which I describe below in case anybody was wondering the same thing).

I have opened up the servers web page while the squeezebox was playing and hovered my mouse above the 'play icons' on the web page and saw the link that issues the command to the server to play the item, for instance:
If I add those links as hyperlinks in the Eventghost Webserver, I will be able to play the files/directories/playlists etc. by clicking that link.

And if I am not mistaken, you can also issue the same command from within Eventghost without using a browser by using this Python script/command:
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Squeezebox Server (former SqueezeCenter)

Post by piert »

OK, now I┬┤m stuck.

I know how to start up an internet radio station on my squeezeboxes, but how do I receive the ┬┤now playing┬┤ information back into Eventghost in such a way that I can make it show on Eventghost┬┤s webserver :?:

I hope somebody knows how to do it and wants to share the knowledge.
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Squeezebox Server (former SqueezeCenter)

Post by piert »

Walter,

Does your plugin offer a way to retrieve ┬┤now playing┬┤ information or the contents of the Squeezebox display?

I have learned that the website http://IPofSqueezeboxserver:9001/status.txt provides the contents of what is currently on a Squeezebox display. Now I would like to show these contents on the dynamic webserver of Eventghost, so that I know what is playing.

However, I have no idea how to ┬┤harvest┬┤ that information and use it in Eventghost.
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Squeezebox Server (former SqueezeCenter)

Post by piert »

I will continue my monologue hoping somebody, someday, somewhere, somehow will care :lol:

I have meanwhile found out that the Zoomplayer plugin that is included with Eventghost contains a TCP-IP server that can be used to communicate with the Squeezebox server.
The server port is 9090, the IP address is the IP address of the computer running the server, which in my case is a NAS.

See also http://forums.slimdevices.com/showthrea ... me-Control
and https://docs.google.com/document/d/1DC6 ... lrQJ&pli=1

When the connection with the server has been confirmed in the Eventghost log and using the following Zoomplayer Raw command as an example

Code: Select all

00%3A04%3A20%3A12%3A12%3Bc9 display ? ?
We get back the contents of whatever is on the display at that time as an event in the Eventghost log

Code: Select all

ZoomPlayer2.5110 [u'00%3A04%3A20%3A12%3A12%3Bc9 display Speelt%20nu LOVE%20REMEMBERS%20--%20Craig%20Morgan']
By the way, the 00%3A04%3A20%3A12%3A12%3Bc9 is the MAC address of the squeezebox player that is queried.

See for a list of possible commands that can be issued
http://192.168.1.34:9001/html/docs/cli-api.html
Interesting features is the ┬┤subscribe┬┤ command, which appears to allow automatic replies back from players when their status changes. I will be experimenting with that some more!

With this it is possible to request information that is received back in an event. The event can be used to create variables that can be included on the Eventghost webserver site. I use the Eventghost webserver to be able to easily send commands to Eventghost from my computer and smartphone , mostly to choose radio stations.
The above procedure allows feedback on the website from the squeezebox player after a command has been issued to it. If, for instance, it can┬┤t connect to a radio stream, it will show the ┬┤can┬┤t connect┬┤ message on the display, which then can be received back as an event and shown on the website.

Now, if somebody could show me an easy way to get rid of the %20 characters in the above Squeezebox server reply to the query, I would appreciate it.

Walter, do you think you could extend your plugin with the capabilities of receiving back information and sending TCP commands, based on the Zoomplayer plugin? Or maybe I overlooked it, and it is already included in your plugin???? :oops:
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Squeezebox Server (former SqueezeCenter)

Post by krambriw »

Walter, do you think you could extend your plugin with the capabilities of receiving back information and sending TCP commands, based on the Zoomplayer plugin? Or maybe I overlooked it, and it is already included in your plugin????
Hi, the current plugin does only support commands. I am using functions inside the player.py and there are many more that I do not use (like get current title, current artist etc). I would suggest that you check those first and then experiment with them a bit. The file player.py is in the plugin folder of the plugin.

Unfortunately I do currently not have time to extend the plugin myself.

Best regards, Walter
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Squeezebox Server (former SqueezeCenter)

Post by piert »

OK, Walter, no problem. You are doing more than enough for the Eventghost community already!!!!!

I have done some further digging and got everything working as I want right now. I have to say my solution is very ┬┤low tech┬┤ as I have no computer programming background and I picked up everything I know from looking at examples and modifying stuff until it suits my needs.

However, as I am sure there are some people out there that, like me, get their ideas mainly from other people explaining their ┬┤line of thoughts┬┤, I will share the python script that I am now using to get rid of the % stuff in the event log. Again, I know there are better, cleaner, more efficient, etc. ways of doing this and I am open to any such suggestions!

Code: Select all

try:

    dummy #Only used to initialise some variables at startup

except NameError:

    dummy = 0 #after the first run, the variable dummy is set, so it skips below on subsequent runs.
    eg.globals.song = False #these are global variables I use to show on the Eventghost website
    eg.globals.titlebar = False

a = eg.event.payload
q = str(a).split('%') # to check if the event has enough information (i.e. if the squeezebox is on)
if len(q) < 25: # I just assumed the number 25 as normal log has way more than 25
    eg.Exit() # if insufficient info, i.e. player is off, don't bother retreiving info. As the status info is also in event, I will switch to that eventually...
else:
    print a #I have included many print commands which I normally use to check to see what is going on...
    import re # needed to work with the regular expression search later on
    b = str(a).split('current_title') #split the event at the part where it starts with the song title
    c = str(b[1]).split('time') # split the second part right after the song title
    #print c[0]
    d = c[0] #this is then the song title, still with the % stuff in it
    e = re.split( r"[%][0-9A-F]{2}" , str(d) ) #this uses the regular expression search to get rid of all % signs and two characters behind it, consisting of a number and letter
    f = ' '.join(e) # the previous result was a list (at least I think it is called a list....), which we now turn into a string again
    print f
    g = str(b[1]).split('title') #this part does the same as the above procedure, only for the radio station part
    #print "g[1]" + g[1] #again, just a print command to see what g[1] actually looks like in the logs
    h = str(g[1]).split('playlist')
    #print "h[0]" + h[0]
    i = re.split( r"[%][0-9A-F]{2}" , str(h[0]) )
    j = ' '.join(i)
    print j
    eg.globals.song = j #so now we have the song that is playing, which we can assign to the global variable for the EG website
    titlebar = f # and radiostation (or the other way around....)

piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Squeezebox Server (former SqueezeCenter)

Post by piert »

Final thing on this. I forgot to include the command that is used to subscribe to a squeezebox player.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1544">
    <Action>
        ZoomPlayer.MyCommand(u'00%3A04%3A20%3A12%3A12%3Bc9 status - 2 subscribe:300')
    </Action>
</EventGhost>
This uses the MAC address of the player to connect to it and then the player itself reports its status back whenever there is a change. For instance, when a song title from an internet radio stream changes, it will result in a status update, which will result in a new event in Eventghost┬┤s log. If there are no changes, the subscribe 300 part means that there will be a status update message anyway every 300 seconds. As explained in previous post in this thread, the information can be used to update Eventghost global variables, which can be included on the EG webserver to show each new change. To do this, the Eventghost html page must contain the eventghost global variable in {}
See http://www.eventghost.org/forum/viewtop ... 671#p20635
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Squeezebox Server (former SqueezeCenter)

Post by krambriw »

Nice, work!

Next would be to make a really nice updating of your webpages without need for refesh of the whole html page. And to get rid of eg.globals...

Look into websockets, you will not be disappointed!

Best regards, Walter
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Squeezebox Server (former SqueezeCenter)

Post by piert »

Thanks for the pointer. I will be checking Websockets out at some point (when I have some time again).

Btw, I understand you also have some squeezeboxes around the house. When you power them up using the remote, how do you keep track of their play state?
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Squeezebox Server (former SqueezeCenter)

Post by krambriw »

Hello,
All my sqb's are synchronized so they are always playing the same songs at the same time (individual volume control though). From EG, I only monitor that they are connected and reachable but I do not monitor the play state at all since I can hear if they are playing or not :idea:

Best regards

PS I will try to make a little sample based on on your script with websocket that updates something...
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Squeezebox Server (former SqueezeCenter)

Post by piert »

krambriw wrote:PS I will try to make a little sample based on on your script with websocket that updates something...
Thanks, I appreciate that!

Best regards
Perry
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Squeezebox Server (former SqueezeCenter)

Post by krambriw »

Hi, I have made some tests and it works nice using websockets!

I have made a very, very simple web page that only holds a few elements (just not to complicate the things too much. It shows only the title and the album like this:
Image14.jpg
Image14.jpg (7.94 KiB) Viewed 6946 times
To make this work, you need to add and configure some plugins, some you already have added. I put it all together in a little guide:
EG_ZoomP_Websockets.zip
(171.75 KiB) Downloaded 244 times
Here is the sample web page you need to put into your web server folder:
sqbLive.zip
(1.28 KiB) Downloaded 234 times
Best regards, Walter
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Squeezebox Server (former SqueezeCenter)

Post by piert »

Wow, Walter, this is super clear and super helpful. Thank you very much!!!!

From looking through the documents I am confident that I can replicate this for the same result and possibly add some more by copy-paste. Unfortunately, I currently lack the time to do it now, so I must hold back my excitement and eagerness to start experimenting.... :cry:

BTW: what html editor do you use? I have been using Kompozer (http://kompozer.net/ but working with tables turns out to be a nightmare, especially if changes / re-arrangements of cells are needed.

Thanks again and best regards,
Perry
Post Reply