Пример #1
0
 def _read_status(self):
     ## Do non-blocking checks for server response until something arrives.
     setStoppable(True)
     try:
         while True:
             sel = select.select([self.fp.fileno()], [], [], 0)
             if len(sel[0]) > 0:
                 break
             ## <--- Right here, check to see whether thread has requested to stop
             ##      Also check to see whether timeout has elapsed
             if util.abortRequested():
                 if DEBUG: util.LOG(' -- XBMC requested abort during wait for server response: raising exception -- ')
                 raise AbortRequestedException('httplib.HTTPResponse._read_status')
             elif STOP_REQUESTED:
                 if DEBUG: util.LOG('Stop requested during wait for server response: raising exception')
                 resetStopRequest()
                 raise StopRequestedException('httplib.HTTPResponse._read_status')
             
             if self._prog_callback:
                 if not self._prog_callback(-1):
                     resetStopRequest()
                     raise StopRequestedException('httplib.HTTPResponse._read_status')
                 
             time.sleep(0.1)
         return httplib.HTTPResponse._read_status(self)
     finally:
         setStoppable(False)
         resetStopRequest()
Пример #2
0
def checkStop():
    if util.abortRequested():
        if DEBUG: util.LOG(' -- XBMC requested abort during wait for connection to server: raising exception -- ')
        raise AbortRequestedException('socket[asyncconnections].create_connection')
    elif STOP_REQUESTED:
        if DEBUG: util.LOG('Stop requested during wait for connection to server: raising exception')
        resetStopRequest()
        raise StopRequestedException('socket[asyncconnections].create_connection')
Пример #3
0
 def _handleQueue(self):
     util.LOG('Threaded TTS Started: {0}'.format(self.provider))
     while self.active and not util.abortRequested():
         try:
             text = self.queue.get(timeout=0.5)
             self.queue.task_done()
             if isinstance(text,int):
                 time.sleep(text/1000.0)
             else:
                 self._threadedIsSpeaking = True
                 self.threadedSay(text)
                 self._threadedIsSpeaking = False
         except Queue.Empty:
             pass
     util.LOG('Threaded TTS Finished: {0}'.format(self.provider))
Пример #4
0
 def _handleQueue(self):
     util.LOG('Threaded TTS Started: {0}'.format(self.provider))
     while self.active and not util.abortRequested():
         try:
             text = self.queue.get(timeout=0.5)
             self.queue.task_done()
             if isinstance(text, int):
                 time.sleep(text / 1000.0)
             else:
                 self._threadedIsSpeaking = True
                 self.threadedSay(text)
                 self._threadedIsSpeaking = False
         except Queue.Empty:
             pass
     util.LOG('Threaded TTS Finished: {0}'.format(self.provider))