Page 1 of 1

Storing parameters passed to webserver as a variable.

Posted: Mon May 07, 2012 3:27 pm
by vader88
I would like to use the webserver plugin to play a file on my PC that is specified by the url.

For example I want to trigger this URL:

Code: Select all

http://192.168.0.10:82?playfile=&filename=test.mkv
And the playfile parameter would trigger the event and I could retrieve the filename to pass along to the action.

When I call the URL it shows up in eventghost like this:

Code: Select all

HTTP.playfile [u'filename=test.mkv']
How do I access the value of filename?

Re: Storing parameters passed to webserver as a variable.

Posted: Mon May 07, 2012 5:56 pm
by vader88
After a lot of searching and playing around I have figured out that what I was searching for was

Code: Select all

eg.event.payload
That variable contains the extra data sent via the webserver. Now I just have to parse it out which should be easy.

Re: Storing parameters passed to webserver as a variable.

Posted: Mon May 07, 2012 6:09 pm
by krambriw

Code: Select all

file_to_play = eg.event.payload.split('=')[1]