def run(argv): # pylint: disable=broad-except,ungrouped-imports # Initialize globals right away to avoid stale values from the last addon invocation. # Otherwise Kodi's reuseLanguageInvoker will cause some really quirky behavior! # PR: https://github.com/xbmc/xbmc/pull/13814 g.init_globals(argv) reset_log_level_global_var() info('Started (Version {})'.format(g.VERSION)) info('URL is {}'.format(g.URL)) success = True window_cls = Window(10000) # Kodi home window # If you use multiple Kodi profiles you need to distinguish the property of current profile prop_nf_service_status = g.py2_encode('nf_service_status_' + get_current_kodi_profile_name()) is_widget_skin_call = _skin_widget_call(window_cls, prop_nf_service_status) if window_cls.getProperty(prop_nf_service_status) != 'running': if not is_widget_skin_call: from resources.lib.kodi.ui import show_backend_not_ready show_backend_not_ready() success = False if success: try: if _check_valid_credentials(): if g.IS_ADDON_FIRSTRUN: check_addon_upgrade() g.initial_addon_configuration() if not is_widget_skin_call: update_cache_videoid_runtime(window_cls) route([part for part in g.PATH.split('/') if part]) else: success = False except BackendNotReady: from resources.lib.kodi.ui import show_backend_not_ready show_backend_not_ready() success = False except Exception as exc: import traceback from resources.lib.kodi.ui import show_addon_error_info error(traceback.format_exc()) show_addon_error_info(exc) success = False if not success: _handle_endofdirectory() g.CACHE.commit() log_time_trace()
def run(argv): # pylint: disable=broad-except,ungrouped-imports # Initialize globals right away to avoid stale values from the last addon invocation. # Otherwise Kodi's reuseLanguageInvoker will cause some really quirky behavior! # PR: https://github.com/xbmc/xbmc/pull/13814 g.init_globals(argv) reset_log_level_global_var() info('Started (Version {})'.format(g.VERSION)) info('URL is {}'.format(g.URL)) success = True window_cls = Window(10000) if not bool(window_cls.getProperty('is_service_running')): from resources.lib.kodi.ui import show_backend_not_ready show_backend_not_ready() success = False if success: try: if _check_valid_credentials(): check_addon_upgrade() g.initial_addon_configuration() route([part for part in g.PATH.split('/') if part]) except BackendNotReady: from resources.lib.kodi.ui import show_backend_not_ready show_backend_not_ready() success = False except Exception as exc: import traceback from resources.lib.kodi.ui import show_addon_error_info error(traceback.format_exc()) show_addon_error_info(exc) success = False if not success: _handle_endofdirectory() g.CACHE.commit() log_time_trace()
'/'.join(pathitems))) else: nav.execute(NAV_HANDLERS[root_handler], pathitems[1:], g.REQUEST_PARAMS) if __name__ == '__main__': # pylint: disable=broad-except # Initialize variables in common module scope # (necessary when reusing language invoker) common.info('Started (Version {})'.format(g.VERSION)) common.info('URL is {}'.format(g.URL)) success = False try: g.initial_addon_configuration() route(filter(None, g.PATH.split('/'))) success = True except common.BackendNotReady: ui.show_backend_not_ready() except Exception as exc: import traceback common.error(traceback.format_exc()) ui.show_addon_error_info(exc) if not success: xbmcplugin.endOfDirectory(g.PLUGIN_HANDLE, succeeded=success) g.CACHE.commit() common.log_time_trace()