def _reset(**kwargs): if not gui.yes_no(_.PLUGIN_RESET_YES_NO): return _close() try: xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":false}}}}' .format(ADDON_ID)) proxyport = settings.getInt(key='_proxyserver_port') shutil.rmtree(ADDON_PROFILE) settings.setInt(key='_proxyserver_port', value=proxyport) system, arch = get_system_arch() settings.set(key="_system", value=system) settings.set(key="_arch", value=arch) download_files() update_settings() change_icon() except: pass xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":true}}}}' .format(ADDON_ID)) gui.notification(_.PLUGIN_RESET_OK) signals.emit(signals.AFTER_RESET) gui.refresh()
def _reset(**kwargs): if not gui.yes_no(_.PLUGIN_RESET_YES_NO): return _close() try: xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":false}}}}' .format(ADDON_ID)) profile_settings = load_profile(profile_id=1) proxyserver_port = int(profile_settings['proxyserver_port']) system = profile_settings['system'] arch = profile_settings['arch'] shutil.rmtree(ADDON_PROFILE) directory = os.path.dirname(ADDON_PROFILE + os.sep + "images") try: if not os.path.exists(directory): os.makedirs(directory) except: pass directory = os.path.dirname(ADDON_PROFILE + os.sep + "cache") try: if not os.path.exists(directory): os.makedirs(directory) except: pass query = "UPDATE `vars` SET `arch`='{arch}', `system`='{system}', `test_running`=0, `proxyserver_port`={proxyserver_port} WHERE profile_id={profile_id}".format( arch=arch, system=system, proxyserver_port=proxyserver_port, profile_id=1) query_settings(query=query, return_result=False, return_insert=False, commit=True) download_files() update_settings() update_prefs() except: pass xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":true}}}}' .format(ADDON_ID)) gui.notification(_.PLUGIN_RESET_OK) signals.emit(signals.AFTER_RESET) gui.refresh()
def daily(): update_settings() check_iptv_link() clear_cache() vod_subscription_file = ADDON_PROFILE + 'vod_subscription.json' if is_file_older_than_x_days(vod_subscription_file, days=1): api.vod_subscription()
def daily(): update_settings() check_iptv_link() clear_cache()
def daily(): update_settings() check_iptv_link() clear_cache() service_timer('daily')
def api_login(): creds = get_credentials() username = creds['username'] password = creds['password'] query = "UPDATE `vars` SET `access_token`='', `household_id`='', `ziggo_profile_id`='' WHERE profile_id={profile_id}".format( profile_id=1) query_settings(query=query, return_result=False, return_insert=False, commit=True) profile_settings = load_profile(profile_id=1) user_agent = profile_settings['user_agent'] HEADERS = { 'User-Agent': user_agent, 'X-Client-Id': profile_settings['client_id'] + "||" + user_agent, } download = api_download(url=profile_settings['session_url'], type='post', headers=HEADERS, data={ "username": username, "password": password }, json_data=True, return_json=True) data = download['data'] code = download['code'] if code and data and check_key( data, 'reason') and data['reason'] == 'wrong backoffice': if profile_settings['base_v3'] == 0: query = "UPDATE `vars` SET `base_v3`=1 WHERE profile_id={profile_id}".format( profile_id=1) query_settings(query=query, return_result=False, return_insert=False, commit=True) else: query = "UPDATE `vars` SET `base_v3`=0 WHERE profile_id={profile_id}".format( profile_id=1) query_settings(query=query, return_result=False, return_insert=False, commit=True) update_settings() download_files() profile_settings = load_profile(profile_id=1) download = api_download(url=profile_settings['session_url'], type='post', headers=HEADERS, data={ "username": username, "password": password }, json_data=True, return_json=True) if not code or not data or not check_key(data, 'oespToken'): if not code: code = {} if not data: data = {} return {'code': code, 'data': data, 'result': False} ziggo_profile_id = '' household_id = '' if profile_settings['base_v3'] == 1: ziggo_profile_id = data['customer']['sharedProfileId'] household_id = data['customer']['householdId'] query = "UPDATE `vars` SET `access_token`='{access_token}', `ziggo_profile_id`='{ziggo_profile_id}', `household_id`='{household_id}' WHERE profile_id={profile_id}".format( access_token=data['oespToken'], ziggo_profile_id=ziggo_profile_id, household_id=household_id, profile_id=1) query_settings(query=query, return_result=False, return_insert=False, commit=True) if profile_settings['base_v3'] == 1: if len(unicode(profile_settings['watchlist_id'])) == 0: api_get_watchlist_id() return {'code': code, 'data': data, 'result': True}
def daily(): update_user_agent() update_settings() check_iptv_link()