Example #1
0
 def library_auto_update(self):
     """Run the library auto update"""
     try:
         # Call the function in a thread to return immediately without blocking the service
         common.run_threaded(True, self._run_library_auto_update)
     except Exception as exc:  # pylint: disable=broad-except
         LOG.error('library_auto_update raised an error: {}', exc)
 def _on_playback_stopped(self):
     if self._playback_tick and self._playback_tick.is_alive():
         self._playback_tick.stop_join()
         self._playback_tick = None
     self.active_player_id = None
     # Immediately send the request to release the license
     common.run_threaded(True, self.msl_handler.release_license)
     self._notify_all(ActionManager.call_on_playback_stopped,
                      self._last_player_state)
     self.action_managers = None
     self.init_count -= 1
Example #3
0
def show_modal_dialog(non_blocking, dlg_class, xml, path, **kwargs):
    """
    Show a modal Dialog in the UI.
    Pass kwargs minutes and/or seconds to have the dialog automatically
    close after the specified time.
    """
    # WARNING: doModal when invoked does not release the function immediately!
    # it seems that doModal waiting for all window operations to be completed before return,
    # for example the "Skip" dialog takes about 30 seconds to release the function (test on Kodi 19.x)
    # To be taken into account because it can do very big delays in the execution of the invoking code
    run_threaded(non_blocking, _show_modal_dialog, dlg_class, xml, path,
                 **kwargs)
    def on_service_tick(self):
        """Check if update is due and trigger it"""
        if not self.enabled:
            return
        if (self.next_schedule is not None
                and self.next_schedule <= datetime.now()
                and self.is_idle()):
            common.debug('Triggering auto update library')

            common.run_threaded(True, auto_update_library, g.ADDON.getSettingBool('lib_sync_mylist'), True)

            g.SHARED_DB.set_value('library_auto_update_last_start', datetime.now())
            self.next_schedule = _compute_next_schedule()
Example #5
0
def show_modal_dialog(non_blocking, dlg_class, xml_filename, **kwargs):
    """
    Show a modal Dialog in the UI.
    Pass kwargs minutes and/or seconds to have the dialog automatically
    close after the specified time.

    :return if exists return self.return_value value of dlg_class (if non_blocking=True return always None)
    """
    # WARNING: doModal when invoked does not release the function immediately!
    # it seems that doModal waiting for all window operations to be completed before return,
    # for example the "Skip" dialog takes about 30 seconds to release the function (probably for the included animation)
    # To be taken into account because it can do very big delays in the execution of the invoking code
    return run_threaded(non_blocking, _show_modal_dialog, dlg_class,
                        xml_filename, **kwargs)
 def library_auto_update(self):
     """Run the library auto update"""
     # Call the function in a thread to return immediately without blocking the service
     common.run_threaded(True, self._run_library_auto_update)