From 040babdcb5f72505120f3ab696052651a96a5ef4 Mon Sep 17 00:00:00 2001 From: axlt2002 Date: Sun, 12 Jul 2020 12:54:11 +0200 Subject: [PATCH 1/3] piccoli edit --- core/videolibrarytools.py | 18 ++++++++++-------- platformcode/xbmc_videolibrary.py | 4 +++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index 5d792721..3759c514 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -566,8 +566,6 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): @return: the number of failed episodes """ logger.info() - update = False - exist = False episodelist = filter_list(episodelist, serie.action, path) # No episode list, nothing to save if not len(episodelist): @@ -577,6 +575,7 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): # process local episodes local_episodes_path = '' local_episodelist = [] + update = False nfo_path = filetools.join(path, "tvshow.nfo") head_nfo, item_nfo = read_nfo(nfo_path) if item_nfo.update_last: @@ -590,9 +589,9 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): filetools.write(nfo_path, head_nfo + item_nfo.tojson()) if local_episodes_path: - from platformcode.xbmc_videolibrary import check_if_exist, clean - if check_if_exist(local_episodes_path): - exist = True + from platformcode.xbmc_videolibrary import check_db, clean + # check if the local episodes are in the Kodi video library + if check_db(local_episodes_path): local_episodelist += get_local_content(local_episodes_path) clean_list = [] for f in filetools.listdir(path): @@ -609,7 +608,6 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): clean_list.append(clean_path) clean_list.append(clean_path.replace('/','\\')) - # from core.support import dbg;dbg() if clean_list: clean(clean_list) update = True @@ -630,7 +628,7 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): item_nfo.local_episodes_list = sorted(local_episodelist) filetools.write(nfo_path, head_nfo + item_nfo.tojson()) - + # the local episodes are not in the Kodi video library else: process_local_episodes(local_episodes_path, path) @@ -713,12 +711,13 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): logger.info("There is no episode list, we go out without creating strm") return 0, 0, 0 + local_episodelist += get_local_content(path) + # fix float because division is done poorly in python 2.x try: t = float(100) / len(new_episodelist) except: t = 0 - local_episodelist += get_local_content(path) for i, e in enumerate(scraper.sort_episode_list(new_episodelist)): if not silent: p_dialog.update(int(math.ceil((i + 1) * t)), config.get_localized_string(60064), e.title) @@ -874,6 +873,7 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): # ... if it was correct we update the Kodi video library if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not silent: update = True + if update: from platformcode import xbmc_videolibrary xbmc_videolibrary.update() @@ -952,6 +952,7 @@ def process_local_episodes(local_episodes_path, path): filetools.write(nfo_path, head_nfo + item_nfo.tojson()) + def get_local_content(path): logger.info() @@ -966,6 +967,7 @@ def get_local_content(path): return local_episodelist + def add_movie(item): """ Keep a movie at the movie library. The movie can be a link within a channel or a previously downloaded video. diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py index be0dfbaa..299fc60b 100644 --- a/platformcode/xbmc_videolibrary.py +++ b/platformcode/xbmc_videolibrary.py @@ -1000,7 +1000,8 @@ def clean(path_list=[]): xbmc.sleep(1000) progress.close() -def check_if_exist(path): + +def check_db(path): if '\\' in path: sep = '\\' else: sep = '/' if path.endswith(sep): path = path[:-len(sep)] @@ -1013,6 +1014,7 @@ def check_if_exist(path): ret = True return ret + def execute_sql_kodi(sql): """ Run sql query against kodi database From ff0d4341f9c87f65e4a2aae0809da631d23f5257 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 12 Jul 2020 14:53:54 +0200 Subject: [PATCH 2/3] ops --- core/videolibrarytools.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index 3759c514..559d2735 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -622,7 +622,6 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): clean_path = '%/' + clean_path.split(sep)[-1] + '/%' + f.replace('x','%') + '%' clean_list.append(clean_path) clean_list.append(clean_path.replace('/','\\')) - from core.support import dbg;dbg() clean(clean_list) update = True @@ -827,7 +826,7 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): if not silent: p_dialog.close() - if news_in_playcounts or emergency_urls_succ or serie.infoLabels["status"] == "Ended" or serie.infoLabels["status"] == "Canceled" or update: + if news_in_playcounts or emergency_urls_succ or serie.infoLabels["status"] == "Ended" or serie.infoLabels["status"] == "Canceled": # If there are new episodes we mark them as unseen on tvshow.nfo ... tvshow_path = filetools.join(path, "tvshow.nfo") try: From bafa08166fede02d853cdbbea4027cf93a39e705 Mon Sep 17 00:00:00 2001 From: marco Date: Sun, 12 Jul 2020 22:57:43 +0200 Subject: [PATCH 3/3] fix per ricerca globale --- channels/casacinemaInfo.json | 2 +- core/channeltools.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/channels/casacinemaInfo.json b/channels/casacinemaInfo.json index f3953133..8fc43a9a 100644 --- a/channels/casacinemaInfo.json +++ b/channels/casacinemaInfo.json @@ -2,7 +2,7 @@ "id": "casacinemaInfo", "name": "La Casa del Cinema", "language": ["ita", "sub-ita"], - "active": true, + "active": false, "thumbnail": "casacinemainfo.png", "banner": "casacinemainfo.png", "categories": ["movie", "vos"], diff --git a/core/channeltools.py b/core/channeltools.py index 2c51ec1d..90a2dd74 100644 --- a/core/channeltools.py +++ b/core/channeltools.py @@ -159,8 +159,13 @@ def get_lang(channel_name): def get_default_settings(channel_name): from core import filetools + import copy + default_path = filetools.join(config.get_runtime_path(), 'default_channel_settings' + '.json') - global default_file + if channel_name not in ['trakt', 'autoplay']: + global default_file + else: + default_file = {} if not default_file: default_file = jsontools.load(filetools.read(default_path)) @@ -180,7 +185,7 @@ def get_default_settings(channel_name): default_off = channel_json['default_off'] if 'default_off' in channel_json else [] # Apply default configurations if they do not exist - for control in default_controls: + for control in copy.deepcopy(default_controls): if control['id'] not in str(channel_controls): if 'include_in_newest' in control['id'] and 'include_in_newest' not in not_active and control[ 'id'] not in not_active: @@ -256,7 +261,6 @@ def get_channel_setting(name, channel, default=None): file_settings = filetools.join(config.get_data_path(), "settings_channels", channel + "_data.json") dict_settings = {} dict_file = {} - if channel not in ['trakt', 'autoplay']: def_settings = get_default_settings(channel) if filetools.exists(file_settings): # We get saved configuration from ../settings/channel_data.json