diff --git a/channels/serietvonline.py b/channels/serietvonline.py index 10f67736..21024310 100644 --- a/channels/serietvonline.py +++ b/channels/serietvonline.py @@ -21,9 +21,9 @@ from platformcode import config from core.item import Item -def findhost(url): - host = support.match(url, patron=r'href="([^"]+)">\s*cliccando qui').matches[-1] - return host +# def findhost(url): +# host = support.match(url, patron=r'href="([^"]+)">\s*cliccando qui').matches[-1] +# return host host = config.get_channel_url() headers = [['Referer', host]] diff --git a/core/support.py b/core/support.py index a806e112..408ec878 100755 --- a/core/support.py +++ b/core/support.py @@ -138,7 +138,7 @@ def scrapeLang(scraped, lang, longtitle): # e credo sia utile per filtertools language = '' - if scraped['lang']: + if scraped.get('lang'): if 'ita' in scraped['lang'].lower(): language = 'ITA' if 'sub' in scraped['lang'].lower(): language = 'Sub-' + language diff --git a/platformcode/config.py b/platformcode/config.py index d6f7753d..eb1e09f1 100644 --- a/platformcode/config.py +++ b/platformcode/config.py @@ -119,7 +119,7 @@ def get_channel_url(findhostMethod=None, name=None, forceFindhost=False): name = os.path.basename(frame[0].f_code.co_filename).replace('.py', '') if findhostMethod: url = jsontools.get_node_from_file(name, 'url') - if not url or 'web.archive.org' in url or forceFindhost: # per eliminare tutti i webarchive salvati causa bug httptools CF, eliminare in futuro + if not url or forceFindhost: url = findhostMethod(channels_data['findhost'][name]) jsontools.update_node(url, name, 'url') return url @@ -139,38 +139,6 @@ def get_system_platform(): return platform -def is_autorun_enabled(): - try: - if "xbmc.executebuiltin('RunAddon(plugin.video.kod)')" in open(os.path.join(xbmc.translatePath('special://userdata'),'autoexec.py')).read(): - return True - else: - return False - except: - # if error in reading from file autoexec doesnt exists - return False - - -def enable_disable_autorun(is_enabled): - # old method, now using service.py - - path = os.path.join(xbmc.translatePath('special://userdata'),'autoexec.py') - append_write = 'a' if os.path.exists(path) else 'w' - - if is_enabled is False: - with open(path, append_write) as file: - file.write("import xbmc\nxbmc.executebuiltin('RunAddon(plugin.video.kod)')") - set_setting('autostart', 'On') - else: - file = open(path, "r") - old_content = file.read() - new_content = old_content.replace("xbmc.executebuiltin('RunAddon(plugin.video.kod)')", "") - file.close() - with open(path, "w") as file: - file.write(new_content) - set_setting('autostart', True) - return True - - def get_all_settings_addon(): # Read the settings.xml file and return a dictionary with {id: value} from core import scrapertools diff --git a/service.py b/service.py index abba4ca3..f92a57d8 100644 --- a/service.py +++ b/service.py @@ -455,9 +455,6 @@ if __name__ == "__main__": if config.get_setting('autostart'): xbmc.executebuiltin('RunAddon(plugin.video.' + config.PLUGIN_NAME + ')') - # handling old autoexec method - if config.is_autorun_enabled(): - config.enable_disable_autorun(True) # port old db to new old_db_name = filetools.join(config.get_data_path(), "kod_db.sqlite") if filetools.isfile(old_db_name): diff --git a/specials/videolibrary.py b/specials/videolibrary.py index 7f10bebe..ee3d60cf 100644 --- a/specials/videolibrary.py +++ b/specials/videolibrary.py @@ -417,6 +417,8 @@ def findvideos(item): all_videolibrary = [] ch_results = [] + list_servers = [] + with futures.ThreadPoolExecutor() as executor: for nom_canal, json_path in list(list_canales.items()): if filtro_canal and filtro_canal != nom_canal.capitalize(): @@ -476,7 +478,6 @@ def findvideos(item): del item.library_urls[nom_canal] item_json = Item().fromjson(filetools.read(json_path)) - list_servers = [] # support.dbg() try: from urllib.parse import urlsplit except ImportError: from urlparse import urlsplit