Page 1 of 2

HTTP explorer

Posted: Thu Oct 11, 2012 12:05 pm
by Pako
I created a new plugin.
You can download it here.
This is something like OSE, but the menu is displayed in a web browser.
I do not know whether it has any practical use (perhaps smart phones), but for me it was a nice introduction to the slightly different things.
I expect, that you will send me your ideas for improvements.
But I can not promise you that I will be able (or willing) to implement all the ideas.

--
Pako

Re: HTTP explorer

Posted: Sat Oct 13, 2012 2:50 pm
by piert
Hi Pako,

First of all, thank you very much for yet another very interesting plugin!!!!

I am playing around with this for a bit, as I am trying to find out if I can use this for selecting and adding music files to the playlist of my Logitech squeezebox.
The squeezebox takes its music from a Qnap NAS on my own LAN.
During the testing, I have enabled your plugin in Eventghost on my laptop locally. I created a new http server in your plugin, which I named muzica.
And sure enough, the music directory listing showed up in my webbrowser, when I pointed to 127.0.0.1:8080.

After fiddling around with file naming conventions in my Python script in EG, I was able to extract the path file from the event of your plugin and use it to start playing the song via my squeezebox. This is great! (for information: the squeezebox already has an 'out of the box webbased control interface', but that is a bit slow and it needs periodic refreshing, which does not look nice).

It would be nice if it was possible to select folder paths (currently, I think it is only possible to create an event when an individual file is clicked, correct?). This way, I could add an entire folder (=music album) to the current playlist at once.
I am not sure if this could be done, but it would be nice.

I have encountered a problem when the webpage went blank after a while of being idle It did not want to do anything more, until I stopped and restarted the HTTP server. The error message was as follows:

EDIT: It may be caused by opening a selected link in another tab. Is the server capable of using several tabs in a webbrowser at once?


16:29:17 ----------------------------------------
16:29:17 Exception happened during processing of request from ('127.0.0.1', 55139)
16:29:17 Traceback (most recent call last):
16:29:17 File "SocketServer.pyc", line 281, in _handle_request_noblock
16:29:17 File "SocketServer.pyc", line 307, in process_request
16:29:17 File "SocketServer.pyc", line 320, in finish_request
16:29:17 File "C:\Program Files\EventGhost\plugins\HTTPExplorer\__init__.py", line 350, in __init__
16:29:17 server
16:29:17 File "SocketServer.pyc", line 615, in __init__
16:29:17 File "BaseHTTPServer.pyc", line 329, in handle
16:29:17 File "BaseHTTPServer.pyc", line 323, in handle_one_request
16:29:17 File "C:\Program Files\EventGhost\plugins\HTTPExplorer\__init__.py", line 374, in do_GET
16:29:17 self.do_everything()
16:29:17 File "C:\Program Files\EventGhost\plugins\HTTPExplorer\__init__.py", line 394, in do_everything
16:29:17 browser.GoTo(self.path[5:-5])
16:29:17 File "C:\Program Files\EventGhost\plugins\HTTPExplorer\__init__.py", line 321, in GoTo
16:29:17 itm = self.ds[int(ix)]
16:29:17 IndexError: list index out of range
16:29:17 ----------------------------------------

Another question: does this interfere in a negative way with the original webserver within Eventghost?

Thanks again and best regards,
Perry

Re: HTTP explorer

Posted: Sat Oct 13, 2012 3:28 pm
by Pako
Thanks for the first response.
1. It is currently not possible to use a folder as an event payload, but I am thinking about it.
2. It is not possible to connect to a single server multiple times (for example, from different device, or from different tab). If you need it, you have to create another server (on a different port). Each server has its own virtual browser that allows you to browse PC. The browser remembers the folder in which it is located. Therefore it is not possible. Otherwise, it would have to do a lot more complicated.
3. This plugin has nothing to do with the current Webserver plugin. There should be no interference.

Pako

Re: HTTP explorer

Posted: Sat Oct 13, 2012 10:11 pm
by piert
points 1 and 2 relate to the same problem for me when selecting music.
My music is in folders by artist and then the songs are in folders per Album.

This means that, to select a song, I have to go multiple levels down, select the song and then go multiple levels up again to find another song to add.
I tried to make the process a bit faster by opening links in other tabs, but like you said this does not work.

If it were possible to select folders, this saves a bit of time, as I would not have to drill all the way down to the songs themselves (I found out how to select the folder a song is in by using some Python scripting. But for this, I still have to be inside the folder at song level).

BTW: I really like your choice of colours and size and font of the directory and song listing. Very clear and large. It looks like this would also work nicely on a tablet or even phone (have not tried these yet).

Best regards,
Perry

Re: HTTP explorer

Posted: Wed Oct 17, 2012 5:40 am
by kalia
Pako,

As always, awesome plugin. Thank you!

I only played with it a little, but a couple of things:

1. Border Colour

I changed the Border Colour in Settings window, but border color stays black. Is it just me?

2. Suggestion to Add Action

If you are interested, it would be nice to have buttons next file names. For example, "OPEN", "DELETE"...

Thanks again.

Re: HTTP explorer

Posted: Wed Oct 17, 2012 7:04 am
by krambriw
Dear Pako,

Tried it and it basically works fine but I saw one problem in my setup. See the log below
1) the http server starts correctly
2) I go to configure the plugin, then I get the errors below

Code: Select all

08:58:48   HTTP server "MyPictures" started on host 0.0.0.0:8282
08:58:52   Traceback (most recent call last) (1544):
08:58:52     File "C:\Program Files\EventGhost\eg\Classes\TaskletDialog.py", line 59, in ProcessingTask
08:58:52       self.Configure(*args, **kwargs)
08:58:52     File "C:\Program Files\EventGhost\eg\Classes\ConfigDialog.py", line 165, in Configure
08:58:52       treeItem.Configure(*args)
08:58:52     File "C:\Program Files\EventGhost\eg\Classes\ActionItem.py", line 101, in Configure
08:58:52       return self.executable.Configure(*args)
08:58:52     File "C:\Program Files\EventGhost\plugins\HTTPExplorer\__init__.py", line 1221, in Configure
08:58:52       serverListCtrl.InsertStringItem(0, maxStr([item.args[0] for item in servActions]))
08:58:52   IndexError: tuple index out of range
Another question, in the browser when selecting a picture as in my example, an event is created in EG. Is something else suppose to happen, like picture being opened in separate tab of browser or similar or is it just the event in EG that should happen?

My best regards, Walter

Re: HTTP explorer

Posted: Wed Oct 17, 2012 9:34 am
by Pako
kalia wrote:Pako,
As always, awesome plugin. Thank you!
Thank you, it's nice to "hear".
kalia wrote:I only played with it a little, but a couple of things:
1. Border Colour
I changed the Border Colour in Settings window, but border color stays black. Is it just me?
Thank you for the warning. You can download the new version in which the bug is fixed.
There are also added option to select the font size and width of the border.
Attention! You have to open and resave the configuration dialogs of all "Start server" actions. Otherwise it will not work correctly.
kalia wrote:2. Suggestion to Add Action
If you are interested, it would be nice to have buttons next file names. For example, "OPEN", "DELETE"...
Thanks again.
Yes, this solution I was already thinking (especially in connection with folders). But I'm afraid the "DELETE" command, it's too dangerous.
Yet I do not know how to handle it. I will return to this issue later. Now I'm working on HTTPmenu plugin.
krambriw wrote:Tried it and it basically works fine but I saw one problem in my setup. See the log below
1) the http server starts correctly
2) I go to configure the plugin, then I get the errors below
I can not seem to evoke the same problem. You can attach your configuration file?

Pako

Re: HTTP explorer

Posted: Wed Oct 17, 2012 12:00 pm
by krambriw
Dear Pako, attached as requested. I realize it is not tested with newest version of EG, I did not expect this was needed.
Best regards, Walter

EDIT: Now tested with latest version of EG (1582), problem is the same

Also, if I issue "Stop all HTTP servers" and then "Start all enabled HTTP servers" I get the following error:

Code: Select all

14:05:31   Traceback (most recent call last) (1544):
14:05:31     File "C:\Program Files\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
14:05:31       return self(*args)
14:05:31     File "C:\Program Files\EventGhost\plugins\HTTPExplorer\__init__.py", line 1045, in __call__
14:05:31       self.plugin.StartAllServers()
14:05:31     File "C:\Program Files\EventGhost\plugins\HTTPExplorer\__init__.py", line 1091, in StartAllServers
14:05:31       self.StartServer(*args)
14:05:31   TypeError: StartServer() takes exactly 20 arguments (1 given)
Image3.jpg
HTTP_Test.xml
(1.36 KiB) Downloaded 281 times

Re: HTTP explorer

Posted: Wed Oct 17, 2012 3:13 pm
by Pako
Dear Walter !
1. I found the cause.
The strange behavior caused by unused action "Start HTTP server" that has not been configured
(I've progressed somewhat unusual in programming).
I will try in some way to treat such cases.
As a workaround you can (yet) this action either delete or configure.

2. Please do not place the action into Autostart folder.
Instead, use a solution similar to the following picture:
HTTPE-StartServer.png
Pako

Re: HTTP explorer

Posted: Fri Oct 19, 2012 3:09 pm
by Pako
Available corrected version.
Now is not a problem, though (in your tree) is there any unconfigured action "Start server".
BTW - I've had almost completed a new plugin "HTTP menu", which works in a similar way. Now, I have yet to test.

Pako

Re: HTTP explorer

Posted: Fri Oct 19, 2012 3:38 pm
by krambriw
Great Pako, very good, I will test during weekend.
Wish you a very nice weekend,
Walter

Re: HTTP explorer

Posted: Sat Oct 20, 2012 7:29 am
by krambriw
Dear Pako,

I cannot see any of the previous problems anymore, I think they are fixed.

Just another observation. Do as follows:

1) start a server

2) start a browser to it and navigate to different paths

3) Leave the browser at any path

4) stop and start the server again without closing the browser

5) go back to browser and try navigate

In EG you get the below error messages (obviously because the browser lost connection). To make it work again. you have to do a refresh in the browser so that it connects again.

Do you think it could be possible to make a re-connection between browser and server Parent.html to happen automatically instead of creating error messages?

Best regards, Walter

Code: Select all

09:19:55   ----------------------------------------
09:19:55   Exception happened during processing of request from ('127.0.0.1', 62421)
09:19:55   Traceback (most recent call last):
09:19:55     File "SocketServer.pyc", line 281, in _handle_request_noblock
09:19:55     File "SocketServer.pyc", line 307, in process_request
09:19:55     File "SocketServer.pyc", line 320, in finish_request
09:19:55     File "C:\Program Files\EventGhost\plugins\HTTPExplorer\__init__.py", line 356, in __init__
09:19:55       server
09:19:55     File "SocketServer.pyc", line 615, in __init__
09:19:55     File "BaseHTTPServer.pyc", line 329, in handle
09:19:55     File "BaseHTTPServer.pyc", line 323, in handle_one_request
09:19:55     File "C:\Program Files\EventGhost\plugins\HTTPExplorer\__init__.py", line 380, in do_GET
09:19:55       self.do_everything()
09:19:55     File "C:\Program Files\EventGhost\plugins\HTTPExplorer\__init__.py", line 402, in do_everything
09:19:55       browser.Execute(int(self.path[5:-5]))
09:19:55     File "C:\Program Files\EventGhost\plugins\HTTPExplorer\__init__.py", line 336, in Execute
09:19:55       itm = self.fs[int(ix)]
09:19:55   AttributeError: 'Browser' object has no attribute 'fs'
09:19:55   ----------------------------------------

Re: HTTP explorer

Posted: Sat Oct 20, 2012 10:50 am
by piert
kalia wrote:2. Suggestion to Add Action
If you are interested, it would be nice to have buttons next file names. For example, "OPEN", "DELETE"...
Thanks again.
I am very interested in your menu solution, Pako.
Do you think it will be possible to add one or, preferably, more permanent hyperlinks to the http explorer page? This would allow someone to go from several folder levels deep to jump back to the top level immediately.

Another solution could be to have multiple 'jump levels up' instead of the current 'one folder up'. Especially in my case of music selection, where the main tree consists of artist folders, then album folders, then individual songs, two jumps up with one mouse press would be convenient.

Re: HTTP explorer

Posted: Mon Oct 22, 2012 5:32 am
by Pako
krambriw wrote:Do you think it could be possible to make a re-connection between browser and server Parent.html to happen automatically instead of creating error messages?
Yes, I agree. I have to make it much more robust.
But that means I'll have to do a fairly large code modifications.
piert wrote:Do you think it will be possible to add one or, preferably, more permanent hyperlinks to the http explorer page? This would allow someone to go from several folder levels deep to jump back to the top level immediately.
Another solution could be to have multiple 'jump levels up' instead of the current 'one folder up'. Especially in my case of music selection, where the main tree consists of artist folders, then album folders, then individual songs, two jumps up with one mouse press would be convenient.
Yes, these are options, of which I had previously thought.


However, I did not know if anyone will be interested in this my new plugin.
And it was not necessary to do it perfectly right from the start.

Pako

Re: HTTP explorer

Posted: Fri Nov 02, 2012 5:11 pm
by Pako
I just released a new version.
I think now it's much better.

Changes:
- extensive reworking for increased stability
- added option to open a file using the default application
- added the possibility of triggering events for folders
- added option to return to any higher level
- incorporated limit - it is impossible to enter below the server root

Attention! You have to open and resave the configuration dialogs of all "Start server" actions.
Otherwise it will not work correctly !

Pako