2013-12-21, 07:30
I've been trying to put something together from other threads i found via google.
I wanted to do some basic communication between skin, python and http.
Type in a domain and use a button to send the string
Then the script
So what things am i doing wrong?
I wanted to do some basic communication between skin, python and http.
Type in a domain and use a button to send the string
Code:
<onclick>RunScript(script.myscript, skinstring1=$INFO[Skin.String(my_domain)])</onclick>
Then the script
Code:
import xbmc
import xbmcgui
import socket
# make param out of arg.
try:
# parse sys.argv for params
try:params = dict( arg.split( "=" ) for arg in sys.argv[ 1 ].split( "&" ) )
except:params = dict( sys.argv[ 1 ].split( "=" ))
except:
# no params passed
params = {}
# make s short for socket.socket.
s = socket.socket(socket.af_inet,socket.sock_dgram)
# connect to domain on port 80 and toggle setting.
def my_timer():
try:
s.connect((skinstring1,80))
s.close()
xbmc.executebuiltin("Skin.ToggleSetting(Site_Alive)")
except:
xbmc.executebuiltin("Skin.Reset(Site_Alive)")
# keep repeating this every x until xbmc closes.
gobject.timeout_add( 60*1000, my_timer )
So what things am i doing wrong?