From aa55d2e37d9f2f7d7a06685ecd72b35fab736b2a Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Thu, 10 Jun 2021 15:20:27 +0200 Subject: [PATCH] - Fix Aggiunta in Videoteca se episodi in Libreria - Fix Aggiungi Episodi Locali da menu contestuale in libreria --- core/videolibrarytools.py | 16 ++++++++-------- platformcode/contextmenu/update_tv_show.py | 7 ++----- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index 096b67d0..1c16fad0 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -585,15 +585,17 @@ 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) + local_episodelist = item_nfo.local_episodes_list if item_nfo.local_episodes_list else [] if config.get_setting('videolibrary_kodi'): from platformcode.xbmc_videolibrary import check_db for p in check_db(item_nfo.infoLabels['code']): local_episodelist += get_local_content(p) + item_nfo.local_episodes_list = local_episodelist + filetools.write(nfo_path, head_nfo + item_nfo.tojson()) if item_nfo.update_last: local_episodes_path = item_nfo.local_episodes_path @@ -606,7 +608,7 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): filetools.write(nfo_path, head_nfo + item_nfo.tojson()) if local_episodes_path: - process_local_episodes(local_episodes_path, path) + process_local_episodes(local_episodes_path, path, local_episodelist) insertados = 0 sobreescritos = 0 @@ -895,24 +897,22 @@ def config_local_episodes_path(path, item, silent=False): return 0, local_episodes_path -def process_local_episodes(local_episodes_path, path): +def process_local_episodes(local_episodes_path, path, local_episodes_list): logger.debug() sub_extensions = ['.srt', '.sub', '.sbv', '.ass', '.idx', '.ssa', '.smi'] artwork_extensions = ['.jpg', '.jpeg', '.png'] extensions = sub_extensions + artwork_extensions - local_episodes_list = [] files_list = [] for root, folders, files in filetools.walk(local_episodes_path): for file in files: if os.path.splitext(file)[1] in extensions: continue season_episode = scrapertools.get_season_and_episode(file) - if season_episode == "": - continue - local_episodes_list.append(season_episode) - files_list.append(file) + if season_episode and season_episode not in local_episodes_list: + local_episodes_list.append(season_episode) + files_list.append(file) nfo_path = filetools.join(path, "tvshow.nfo") head_nfo, item_nfo = read_nfo(nfo_path) diff --git a/platformcode/contextmenu/update_tv_show.py b/platformcode/contextmenu/update_tv_show.py index 04a6835c..8c40e50e 100644 --- a/platformcode/contextmenu/update_tv_show.py +++ b/platformcode/contextmenu/update_tv_show.py @@ -145,12 +145,9 @@ def get_menu_items(): update_text = config.get_localized_string(60023) value = 1 items.append((update_text, - lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (item_url, - "title=" + update_text + "&action=mark_tvshow_as_updatable&channel=videolibrary&active=" + str(value))))) + lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?{}&title={}&action=mark_tvshow_as_updatable&channel=videolibrary&active={})".format(item_url, update_text, str(value))))) if item.local_episodes_path == "": - items.append((config.get_localized_string(80048), - lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % - (item_url, "action=add_local_episodes&channel=videolibrary")))) + items.append((config.get_localized_string(80048), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?{}&action=add_local_episodes&channel=videolibrary&path={})".format(item_url, path)))) # if config.get_setting('downloadenabled'): # from core import videolibrarytools