run = 'RunScript(script.trakt, action=sync, silent=True)' xbmc.executebuiltin(run) self.reset() def onPlayBackEnded(self): log_utils.log('Service: Playback completed') self.onPlayBackStopped() monitor = Service() utils.do_startup_task(MODES.UPDATE_SUBS) errors=0 while not xbmc.abortRequested: try: isPlaying = monitor.isPlaying() utils.do_scheduled_task(MODES.UPDATE_SUBS, isPlaying) if monitor.tracked and monitor.isPlayingVideo(): monitor._lastPos = monitor.getTime() except Exception as e: errors += 1 if errors >= MAX_ERRORS: log_utils.log('Service: Error (%s) received..(%s/%s)...Ending Service...' % (e, errors, MAX_ERRORS), xbmc.LOGERROR) break else: log_utils.log('Service: Error (%s) received..(%s/%s)...Continuing Service...' % (e, errors, MAX_ERRORS), xbmc.LOGERROR) else: errors=0 xbmc.sleep(1000) log_utils.log('Service: shutting down...')
log_utils.log('Disabling Global CX while SALTS is active', log_utils.LOGDEBUG) was_on = True sf.setSetting('CONTEXT', 'false') elif was_on: log_utils.log('Re-enabling Global CX while SALTS is not active', log_utils.LOGDEBUG) sf.setSetting('CONTEXT', 'true') was_on = False errors = 0 while not xbmc.abortRequested: try: isPlaying = monitor.isPlaying() utils.do_scheduled_task(MODES.UPDATE_SUBS, isPlaying) if monitor.tracked and monitor.isPlayingVideo(): monitor._lastPos = monitor.getTime() except Exception as e: errors += 1 if errors >= MAX_ERRORS: log_utils.log( 'Service: Error (%s) received..(%s/%s)...Ending Service...' % (e, errors, MAX_ERRORS), log_utils.LOGERROR) break else: log_utils.log( 'Service: Error (%s) received..(%s/%s)...Continuing Service...' % (e, errors, MAX_ERRORS), log_utils.LOGERROR) else: errors = 0