Beispiel #1
0
    def event_processing_loop(self):
        # type: () -> None
        """

        :return:
        """
        try:
            # Cheat and start the back_end_bridge here, although this method
            # should just be a loop.

            self.start_back_end_bridge()

            # For the first 10 seconds use a short timeout so that initialization
            # stuff is handled quickly. Then revert to 1 second checks

            initial_timeout = 0.05
            switch_timeouts_count = 10 * 20

            i = 0
            timeout = initial_timeout

            # Using _wait_for_abort to
            # cause Monitor to query Kodi for Abort on the main thread.
            # If this is not done, then Kodi will get constipated
            # sending/receiving events to plugins.

            while not Monitor._wait_for_abort(timeout=timeout):
                i += 1
                if i == switch_timeouts_count:
                    timeout = 0.10

                try:
                    task = self._callableTasks.get(block=False)
                    self.run_task(task)
                except Empty as e:
                    pass

            Monitor.throw_exception_if_abort_requested(timeout=timeout)

        except AbortException:
            reraise(*sys.exc_info())
        except Exception as e:
            type(self)._logger.exception('')
Beispiel #2
0
    def event_processing_loop(cls) -> None:
        """

        :return:
        """
        try:
            # For the first 10 seconds use a short timeout so that initialization
            # stuff is handled quickly. Then revert to 0.10 seconds

            initial_timeout = 0.05
            switch_timeouts_count = 10 * 20

            i = 0
            timeout = initial_timeout

            # Using _wait_for_abort to
            # cause Monitor to query Kodi for Abort on the main thread.
            # If this is not done, then Kodi will get constipated
            # sending/receiving events to plugins.

            while not Monitor._wait_for_abort(timeout=timeout):
                i += 1
                if i == switch_timeouts_count:
                    timeout = 0.10

                try:
                    task = cls._callableTasks.get(block=False)
                    cls.run_task(task)
                except queue.Empty:
                    pass

            Monitor.throw_exception_if_abort_requested(timeout=timeout)

        except AbortException:
            if REMOTE_DEBUG:
                try:
                    pydevd.stoptrace()
                except Exception:
                    pass
            reraise(*sys.exc_info())
        except Exception as e:
            cls._logger.exception(e)