def start(self): self.checkNewVersion() try: while (not xbmc.abortRequested) and (not self.stop): #Interface reader mode while self.readerOn and (not xbmc.abortRequested) and ( not self.stop): xbmc.sleep(self.interval) try: self.checkForText() except RuntimeError: util.ERROR('start()', hide_tb=True) except SystemExit: if util.DEBUG: util.ERROR('SystemExit: Quitting') else: util.LOG('SystemExit: Quitting') break except TTSClosedException: util.LOG('TTSCLOSED') except: #Because we don't want to kill speech on an error util.ERROR('start()', notify=True) self.initState( ) #To help keep errors from repeating on the loop #Idle mode while (not self.readerOn) and (not xbmc.abortRequested) and ( not self.stop): try: text, interrupt = self.noticeQueue.get_nowait() self.sayText(text, interrupt) self.noticeQueue.task_done() except Queue.Empty: pass except RuntimeError: util.ERROR('start()', hide_tb=True) except SystemExit: if util.DEBUG: util.ERROR('SystemExit: Quitting') else: util.LOG('SystemExit: Quitting') break except TTSClosedException: util.LOG('TTSCLOSED') except: #Because we don't want to kill speech on an error util.ERROR('start()', notify=True) self.initState( ) #To help keep errors from repeating on the loop for x in range( 5 ): #Check the queue every 100ms, check state every 500ms if self.noticeQueue.empty(): xbmc.sleep(100) finally: self._tts._close() self.end() util.playSound('off') util.LOG('SERVICE STOPPED') if self.disable: import enabler enabler.disableAddon()
def start(self): self.checkNewVersion() try: while (not xbmc.abortRequested) and (not self.stop): #Interface reader mode while self.readerOn and (not xbmc.abortRequested) and (not self.stop): xbmc.sleep(self.interval) try: self.checkForText() except RuntimeError: util.ERROR('start()',hide_tb=True) except SystemExit: if util.DEBUG: util.ERROR('SystemExit: Quitting') else: util.LOG('SystemExit: Quitting') break except TTSClosedException: util.LOG('TTSCLOSED') except: #Because we don't want to kill speech on an error util.ERROR('start()',notify=True) self.initState() #To help keep errors from repeating on the loop #Idle mode while (not self.readerOn) and (not xbmc.abortRequested) and (not self.stop): try: text, interrupt = self.noticeQueue.get_nowait() self.sayText(text,interrupt) self.noticeQueue.task_done() except Queue.Empty: pass except RuntimeError: util.ERROR('start()',hide_tb=True) except SystemExit: if util.DEBUG: util.ERROR('SystemExit: Quitting') else: util.LOG('SystemExit: Quitting') break except TTSClosedException: util.LOG('TTSCLOSED') except: #Because we don't want to kill speech on an error util.ERROR('start()',notify=True) self.initState() #To help keep errors from repeating on the loop for x in range(5): #Check the queue every 100ms, check state every 500ms if self.noticeQueue.empty(): xbmc.sleep(100) finally: self._tts._close() self.end() util.playSound('off') util.LOG('SERVICE STOPPED') if self.disable: import enabler enabler.disableAddon()
def __init__(self): self.readerOn = True self.stop = False self.disable = False self.noticeQueue = Queue.Queue() self.initState() self._tts = None self.backendProvider = None util.stopSounds() #To kill sounds we may have started before an update util.playSound('on') self.playerStatus = playerstatus.PlayerStatus(10115).init() self.bgProgress = backgroundprogress.BackgroundProgress(10151).init() self.noticeDialog = notice.NoticeDialog(10107).init() self.initTTS() util.LOG('SERVICE STARTED :: Interval: %sms' % self.tts.interval)
def play(self): duration = util.playSound('busy',return_duration=True) self.next = time.time() + duration
def play(self): duration = util.playSound('busy', return_duration=True) self.next = time.time() + duration