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.

Tornado (webserver with WebSocket)

Questions and comments specific to a particular plugin should go here.
Post Reply
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Tornado (webserver with WebSocket)

Post by Pako »

I have a surprise for you.
I created a new plugin. As is evident from the topic title, it's actually a webserver with support WebSocket protocol.
I think something like that, very missed here. I used Tornado library as a base, and I used the same name for the plugin.

During testing, I have prepared one application that uses some WebSocket actions. So everyone can try!
It is a web interface to control the MusicBee program.

Attached is everything you need. Plugin is packed in zip (including folder).
After unpacking, the whole folder (and its contents) put into the folder ...\EventGhost\plugins.
Please use the latest version of the MusicBee plugin!
Of course you need to set the root of html documents and TCP/IP port in the plugin settings.
In settings of MusicBee plugin you have to adjust the location of the MusicBee program.

I have a good feeling - it works very smoothly.
What is the main: no more polling !
As usual, when I publish a new plugin, I beg you to perform proofreading.
And of course - I welcome any feedback.

Thanks, Pako

Installation instructions:
A) Complete instalation (for new users)
A.1) In folder ...\EventGhost\plugins create new folder Tornado
A.2) Download the file __init__.py (at the bottom of this post) and move it to new folder ...\EventGhost\plugins\Tornado
A.3) Restart EventGhost and add the plugin Tornado to your configuration.

B) Upgrade from version 0.3 or lower to version 0.4 or higher
B.1) In the folder ...\EventGhost\plugins\Tornado there exist a folder lib. Delete it.
B.2) Download the file __init__.py and move it to folder ...\EventGhost\plugins\Tornado (replacing the file with the same name).
B.3) Restart EventGhost

C) Other upgrade
C.1) Download the file __init__.py and move it to folder ...\EventGhost\plugins\Tornado (replacing the file with the same name).
C.2) Restart EventGhost
Attachments
__init__.py
Plugin - version 0.6 (released 2015-03-04)
- message can now include the word "Ping"
(125.75 KiB) Downloaded 221 times
TornadoSampleApp.zip
EventGhost config. file (XML) and HTML documents
(172.11 KiB) Downloaded 328 times
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Tornado (webserver with WebSocket)

Post by Pako »

This is how it looks on my phone Sony Xperia T.
Screenshot_2014-01-13-13-47-59.png
Using browser: UC Browser.

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

Re: Tornado (webserver with WebSocket)

Post by krambriw »

Dear Pako, you are again making something very impressive!!!

BR Walter
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Tornado (webserver with WebSocket)

Post by Pako »

krambriw wrote:Dear Pako, you are again making something very impressive!!!
BR Walter
Dear Walter,
I thank you for the compliment.
I hope more people will appreciate it.
It does not appear, but it took many hours to do it.
I have not counted the time, but I estimate it at around 100 hours.
You've already tried it? I expect a more detailed response. :)

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

Re: Tornado (webserver with WebSocket)

Post by piert »

Hi Pako,

First of all, thank you again for a cool contribution.

Unfortunately, I can not yet get it to work.

I installed MusicBee on my laptop.
I downloaded the MusicBee Plugin and made sure the dll is in the plugin folder of MusicBee.
Downloaded the Tornado plugin and the example files (example files are in folder D:\temp\DELETE NOW).
At first try when running the Tornado webserver, I got a blank (white) page showing something like "Tornado is running"(with a running clock), so I thought I was on the right track). However, the MusicBee control page did not show up.
After trying several things in the configurations of the Tornado and MusicBee plugins, I no longer get the blank page, but a coloured page without any of the buttons (I checked the source of the index page, and I see there are a number of buttons that should show on it).

I have made a few screen shots which may make it more clear what is going on:

This is what I see when loading the webserver (index)file (using the 127.0.0.1 URL of the computer itself). Browser is Firefox.
Image

This is what I see when I open the index file in the folder where the index file is located in the browser:
Image

This is the contents of the folder of the index file (i.e. the unzipped example files):
Image

I hope the above makes sense to do some troubleshooting. I really want to get this working!!! :D

Thanks and best regards,
Perry
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Tornado (webserver with WebSocket)

Post by Pako »

Hi Perry!
I am pleased your interest in the plugin.
1) Use a different browser. For example, Chrome displays the page correctly.
2) When you see the page "It works", it means that you did not specify the name of the HTML document.
In our case, you type the server address (and :port, if not standard), then you must also add /index.html .
So in the browser you must enter for example: http://127.0.0.1:8080/index.html .

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

Re: Tornado (webserver with WebSocket)

Post by piert »

A reboot did the trick. I now have the correct page, but am a bit stuck as what to do next to make it 'alive'.

I see that when I hit the buttons on the webpage, corresponding commands appear in Eventghost's event log. Obviously, these events can be used to drag to the corresponding commands in MusicBee, which allows control of the player.
But how do I get information from MusicBee into the webpage? I see that, after each song change, an event appears in the Eventghost event log.
For instance:
MusicBee.TrackChanged [u'D:\\muziek\\11 Two Step.MP3', u'\n\n']

Where do I need to drag that Event to in order for making the song name appear on the webpage???
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Tornado (webserver with WebSocket)

Post by Pako »

And you used the attached file Tornado_Sample_App.xml ?

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

Re: Tornado (webserver with WebSocket)

Post by piert »

Well I am not sure. I just re-tried and I now got an error regarding loading of the MusicBee Plugin. By default the plugin chooses a different folder than the one where MusicBee is installed. If I change to the correct location in the plugin configuration of MusicBee plugin, I get the following error in the log:
Image
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Tornado (webserver with WebSocket)

Post by Pako »

piert wrote:By default the plugin chooses a different folder than the one where MusicBee is installed.
Pako wrote:Of course you need to set the root of html documents and TCP/IP port in the plugin settings.
In settings of MusicBee plugin you have to adjust the location of the MusicBee program.
Ignore the errors, save the document (EventGhost - File - Save)
EventGhost close and re-start it.
It should help.

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

Re: Tornado (webserver with WebSocket)

Post by piert »

Excellent!!!! :D :D :D All is working beatifully now!!! Thank you Pako!!!!!!!
It is very convenient that you made the example XML configuration as this explains how the many options work. I don't have much time at the moment, but will investigate further in the weekend and will let you know if more questions pop up regarding usage.

One more question for now: what is the best way to make custom modifications to the Website? I would like to add text fields to bring in several other types of information and add buttons to create other Eventghost actions. Can you recommend software that allows easy editing of the web-page?
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Tornado (webserver with WebSocket)

Post by Pako »

piert wrote:All is working beatifully now!!!
I'm glad we managed it together. :D
piert wrote:Can you recommend software that allows easy editing of the web-page?
I probably disappoint you, I use only a plain text editor.
Pako
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Tornado (webserver with WebSocket)

Post by piert »

Wow, respect!
The only disappointment is for myself; it means I will have to 'reverse-engineer' my way to modify the index page by means of trial and error :lol:

Ps: I now have two separate browsers connected to the same MusicBee control and in sync: one on the source laptop; the other a tablet on the same LAN. Indeed, instant sync without the frequent and annoying re-loading of the webpage. Thanks again, Pako, well done!!!
therealbiglou
Experienced User
Posts: 126
Joined: Sat May 19, 2012 4:33 am

Re: Tornado (webserver with WebSocket)

Post by therealbiglou »

Pako,

Would this be possible to use to create a web app similar to your MusicBee one for controlling Pandora in a browser?

Thanks!
Brian
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Tornado (webserver with WebSocket)

Post by Pako »

therealbiglou wrote:Would this be possible to use to create a web app similar to your MusicBee one for controlling Pandora in a browser?
I do not know.
I do not know what it is Pandora.
However, one thing is certain. If you can control Pandora via EventGhost,
then you can do it even through Tornado plugin.

Pako
Post Reply