def Start(): HTTP.CacheTime = 0 HTTP.Headers['User-agent'] = OS_PLEX_USERAGENT config.init_cache() # clear expired intents intent = get_intent() intent.cleanup() #Locale.DefaultLocale = "de" # clear expired menu history items now = datetime.datetime.now() if "menu_history" in Dict: for key, timeout in Dict["menu_history"].copy().items(): if now > timeout: try: del Dict["menu_history"][key] except: pass # run migrations if "subs" in Dict or "history" in Dict: Thread.Create(dispatch_migrate) # clear old task data scheduler.clear_task_data() # init defaults; perhaps not the best idea to use ValidatePrefs here, but we'll see ValidatePrefs() Log.Debug(config.full_version) if not config.permissions_ok: Log.Error("Insufficient permissions on library folders:") for title, path in config.missing_permissions: Log.Error("Insufficient permissions on library %s, folder: %s" % (title, path)) # run task scheduler scheduler.run() # bind activities if config.enable_channel: Thread.Create(activity.start) if "anon_id" not in Dict: Dict["anon_id"] = get_identifier() # track usage if cast_bool(Prefs["track_usage"]): if "first_use" not in Dict: Dict["first_use"] = datetime.datetime.utcnow() Dict.Save() track_usage("General", "plugin", "first_start", config.version) track_usage("General", "plugin", "start", config.version)