Add a pinger thread to ping XBMC every 55 seconds
This closes #2 on Github.
This commit is contained in:
parent
232178e2fb
commit
0598e68d13
11
xbmc-wiimote
11
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:
|
||||
|
|
Loading…
Reference in New Issue