disable json url updates

This commit is contained in:
marco
2019-06-21 17:49:08 +02:00
parent c692322053
commit 582a5daf7a
+24 -24
View File
@@ -309,29 +309,29 @@ def monitor_update():
logger.info("Inicio actualizacion programada para las %s h.: %s" % (update_start, datetime.datetime.now())) logger.info("Inicio actualizacion programada para las %s h.: %s" % (update_start, datetime.datetime.now()))
check_for_update(overwrite=False) check_for_update(overwrite=False)
def get_channel_json(): # def get_channel_json():
import urllib, os, xbmc # import urllib, os, xbmc
addon = config.get_addon_core() # addon = config.get_addon_core()
ROOT_DIR = config.get_runtime_path() # ROOT_DIR = config.get_runtime_path()
LOCAL_FILE = os.path.join(ROOT_DIR, "channels.json") # LOCAL_FILE = os.path.join(ROOT_DIR, "channels.json")
#
if os.path.exists(LOCAL_FILE): # if os.path.exists(LOCAL_FILE):
os.remove(LOCAL_FILE) # os.remove(LOCAL_FILE)
urllib.urlretrieve("https://raw.githubusercontent.com/kodiondemand/addon/master/channels.json", LOCAL_FILE) # urllib.urlretrieve("https://raw.githubusercontent.com/kodiondemand/addon/master/channels.json", LOCAL_FILE)
#
if addon.getSetting("use_custom_url") != "true": # if addon.getSetting("use_custom_url") != "true":
channels_path = os.path.join(ROOT_DIR, "channels", '*.json') # channels_path = os.path.join(ROOT_DIR, "channels", '*.json')
channel_files = sorted(glob.glob(channels_path), key=lambda x: os.path.basename(x)) # channel_files = sorted(glob.glob(channels_path), key=lambda x: os.path.basename(x))
for channel_file in channel_files: # for channel_file in channel_files:
if channel_file: # if channel_file:
try: import json # try: import json
except: import simplejson as json # except: import simplejson as json
with open(LOCAL_FILE) as f: # with open(LOCAL_FILE) as f:
data = json.load(f) # data = json.load(f)
try: # try:
if data[channel_file]: # if data[channel_file]:
config.set_setting(name=data[channel_file], value="value", channel=channel_file) # config.set_setting(name=data[channel_file], value="value", channel=channel_file)
except: pass #channel not in json # except: pass #channel not in json
if __name__ == "__main__": if __name__ == "__main__":
# Se ejecuta en cada inicio # Se ejecuta en cada inicio
@@ -359,7 +359,7 @@ if __name__ == "__main__":
logger.info("DEV MODE OFF") logger.info("DEV MODE OFF")
from platformcode import updater from platformcode import updater
updater.check_addon_init() updater.check_addon_init()
get_channel_json() # get_channel_json() -> disabilitato, lo si fa con l'updater
else: else:
logger.info("DEV MODE ON") logger.info("DEV MODE ON")