Add a pinger thread to ping XBMC every 55 seconds

This closes #2 on Github.
This commit is contained in:
Paul van Tilburg 2012-10-19 20:42:38 +02:00
parent 232178e2fb
commit 0598e68d13
1 changed files with 11 additions and 0 deletions

View File

@ -57,6 +57,13 @@ class TimerReset(Thread):
self.finished.clear()
### end of included code
class Pinger(Thread):
def run(self):
global xbmc
while(True):
sleep(55)
xbmc.ping()
# Default settings
PROGRAM = "XBMC Wiimote Gateway"
ICON = "/usr/share/pixmaps/xbmc/bluetooth.png"
@ -170,6 +177,10 @@ def main():
xbmc = XBMCClient(PROGRAM, icon_file=ICON)
xbmc.connect()
# Start the pinger thread to frequently let XBMC know we are still here.
ping = Pinger()
ping.start()
while(True):
# The main loop.
try: