2010-05-19, 00:56
Hi
I've been running this script for several years on the XBOX (it slightly modified, but the unmodified hangs too).
I have now an Asrock ION 330 and I've put the script into autoexec.py and now it freezes when I try to shut down XBMC.
Can I change the script so it won't freeze?
I've been running this script for several years on the XBOX (it slightly modified, but the unmodified hangs too).
I have now an Asrock ION 330 and I've put the script into autoexec.py and now it freezes when I try to shut down XBMC.
Can I change the script so it won't freeze?
PHP Code:
import socket
import xbmc, xbmcgui, threading, thread
from time import *
from string import *
TIMEOUT = 15
PORT = 10629
HOSTNAME = '' # Symbolic name meaning the local host
class caller(xbmcgui.WindowDialog):
def __init__(self):
w = self.getWidth()
h = self.getHeight()
self.addControl(xbmcgui.ControlImage(w - 490, h - 240, 420, 170, 'special://home/scripts/CallerID/frame.png'))
self.addControl(xbmcgui.ControlLabel(w - 475, h - 229, 380, 20, 'Nummerpresentation', 'font13', '0xffffffff'))
self.addControl(xbmcgui.ControlLabel(w - 470, h - 173, 302, 128, data, 'font14', '0xff000000'))
self.a = -1
self.shown = 1
subThread = threading.Thread(target=self.SubthreadProc, args=())
subThread.start()
def SubthreadProc(self):
sleep(TIMEOUT)
if self.shown:
self.close()
def onAction(self, action):
if self.a == action:
self.shown = 0
self.close()
self.a = action
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOSTNAME, PORT))
data = ""
name = ""
number = ""
while 1:
s.listen(1)
conn, addr = s.accept()
a = conn.recv(1024)
alist = split(a[5:], "~")
if len(alist) > 1:
name = alist[0]
number = alist[1]
data = number + "\n" + name
else:
data = a
if data != "":
print(data)
w = caller()
w.doModal()
del w
conn.close()
data = ""
name = ""
number = ""