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.

How would one approach in tackling this problem?

If you have a question or need help, this is the place to be.
Post Reply
thejipster
Posts: 19
Joined: Fri Sep 07, 2007 10:19 pm

How would one approach in tackling this problem?

Post by thejipster »

I have a Context folder created with macros that send IR signals via the USB-UIRT called "Remote". Within it I have created Event names called "1", "2", "3", "4", "5", "6", etc... "a", "b", "c", etc...

I have played around w/ the HTTP plugin (listening on port 88) and figured out how to change to this context folder.

I would like to send a single line command to have it call various macros in this context.
http://serverIP:88/index.html?1255ab

This would generate event "1", event "2", event "5" , event "5", event "a", event "b".

One way I was thinking is to use another webserver to take in this 1255ab string and print out individual http links that I can click on, such as
http://serverIP:88/index.html?1
http://serverIP:88/index.html?2
http://serverip:88/indext.html?5
etc..

But I was hoping the creative community here can shed some light on how this may be achieved more gracefully

Thanks
- J
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: How would one approach in tackling this problem?

Post by Bitmonster »

Use an URL like this:
http://serverIP:88/index.html?MultiEvent&1&2&5&5&a&b

Make a macro for the "Webserver.MultiEvent" event with this PythonScript:

Code: Select all

for eventstring in event.payload:
    eg.TriggerEvent(eventstring)
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
thejipster
Posts: 19
Joined: Fri Sep 07, 2007 10:19 pm

Re: How would one approach in tackling this problem?

Post by thejipster »

Thanks for the hint on this.

I ended up doing something like this. I am beginning to like Python. Seems like it can do most things Perl can. The next thing to do is learn the libraries that exist out there. Don't laugh at my spagetti code. I only spent like 10 minutes of reading Python and 10 minutes hacking this together.

# Usage from Webserver plugin
# The two parameters passed must be 32 characters long.
#http://192.168.2.150:88/index.html?NewC ... 7890123456

# defining a simple function
def Send(codeSegment):
# need to add in some sanity check to ensure that the code is 32 chars long before looping.
for button in range(0, 15):
# need to put delay here.
eg.TriggerEvent(codeSegment[button])
eg.TriggerEvent("Down")

for button in range(16, 31):
eg.TriggerEvent(codeSegment[button])
eg.TriggerEvent("Ok")
eg.TriggerEvent("Wait5")
# end of Send function

##
## begin main section
##
eg.TriggerEvent("UsePansat") #use Pansat context
eg.TriggerEvent("SuperExit") #Exit to the TV channel first
eg.TriggerEvent("GoToNagra2") #get into Nagra menu

newCode1 = eg.event.payload[0]
newCode2 = eg.event.payload[1]

Send(newCode1)
eg.TriggerEvent("Up")
eg.TriggerEvent("Up")
eg.TriggerEvent("Right")
eg.TriggerEvent("Down")

Send(newCode2)
eg.TriggerEvent("SuperExit")

For those who maybe wonderin, this is a simple script used to send in the new Dish codes to the Pansat 2500a receiver since the autoroll is no longer working.

- J
Post Reply