From 0598e68d13cc9ab97da09bd56e312908624762c3 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Fri, 19 Oct 2012 20:42:38 +0200 Subject: [PATCH] Add a pinger thread to ping XBMC every 55 seconds This closes #2 on Github. --- xbmc-wiimote | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xbmc-wiimote b/xbmc-wiimote index b5d6e70..1ddc946 100755 --- a/xbmc-wiimote +++ b/xbmc-wiimote @@ -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: