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.

Using urllib and writing results...

If you have a question or need help, this is the place to be.
Post Reply
JustGav
Posts: 9
Joined: Mon Apr 27, 2009 2:39 pm

Using urllib and writing results...

Post by JustGav »

I'm currently try to open an url which simply returns a status back. Little bit of background, I'm using XBMC and the rather good plugin from here. I am however after a way of getting status info.

I'm running XAMPP on my core system, which has EventGhost on it. It connects to the multiple XBMC systems and controls them nicely, however I want to do a little bit more with it. Longer term I will design a single HA console that will be the master system, but for now a simple webpage simply showing what is playing on the various systems.

I have added
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Name="Configuration Tree" Expanded="True" Version="851" Guid="{75D06BB1-5AA7-4D9D-9B24-2BB5CAE37537}" Time="1240851451.01">
<Autostart Name="Autostart" Expanded="True">

<Plugin File="FileOperations" Identifier="FileOperations">
gAIpLg==
</Plugin>
<Action>
EventGhost.PythonCommand(u'import urllib')
</Action>
</Autostart>
<Folder Name="Systems Monitoring" Expanded="True">
<Macro Name="File Operations: Write {eg.result} to file: C:\xampp\htdocs\alice\holosuite_status.txt" Expanded="True">
<Action>
EventGhost.PythonCommand(u'u\'urllib.urlopen("http://192.168.150.16/xbmcCmds/xbmcHttp ... tlyPlaying")\'')
</Action>
<Action>
FileOperations.Write(2, u'{eg.result}', u'C:\\xampp\\htdocs\\alice\\holosuite_status.txt', 0, 0, False, False, False, 'cp1252')
</Action>
</Macro>
The bit, I'm trying to get joined together is the output from the urllib.urlopen statement, so that the FileOperations writes it to the file, which the XAMPP php server then displays.

Again, I might possibly be making this a lot harder than it needs to be :)

Thanks

Gav
JustGav
Posts: 9
Joined: Mon Apr 27, 2009 2:39 pm

Re: Using urllib and writing results...

Post by JustGav »

Found a different way round...

<Folder Name="Systems Monitoring" Expanded="True">
- <Macro Name="File Operations: Write {eg.result} to file: C:\xampp\htdocs\alice\holosuite_status.txt" Expanded="True">
<Action>EventGhost.PythonCommand(u'u\'urllib.urlretrieve("http://192.168.150.16/xbmcCmds/xbmcHttp ... status.txt)\'')</Action>
</Macro>
</Folder>
Post Reply