diff --git a/core/tmdb.py b/core/tmdb.py index f24659c7..00b7e67d 100644 --- a/core/tmdb.py +++ b/core/tmdb.py @@ -540,7 +540,7 @@ def get_nfo(item, search_groups=False): path = filetools.join(config.get_data_path(), "settings_channels", item.channel + "_data.json") if filetools.exists(path): g = jsontools.load(filetools.read(path)).get(RENUMBER,{}).get(item.fulltitle.strip(),{}).get(GROUP,'') - if g: return g + if g: return g + '\n' groups = get_groups(item) diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index 40672900..f6d187c3 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -14,6 +14,7 @@ from core import filetools, scraper, scrapertools from core.item import Item from lib import generictools from platformcode import config, logger, platformtools +from platformcode.autorenumber import RENUMBER FOLDER_MOVIES = config.get_setting("folder_movies") FOLDER_TVSHOWS = config.get_setting("folder_tvshows") @@ -236,10 +237,10 @@ def update_renumber_options(item, head_nfo, path): filename = filetools.join(config.get_data_path(), "settings_channels", channel + '_data.json') json_file = jsontools.load(filetools.read(filename)) - if 'TVSHOW_AUTORENUMBER' in json_file: - json = json_file['TVSHOW_AUTORENUMBER'] + if RENUMBER in json_file: + json = json_file[RENUMBER] if item.fulltitle in json: - item.channel_prefs[channel]['TVSHOW_AUTORENUMBER'] = json[item.fulltitle] + item.channel_prefs[channel][RENUMBER] = json[item.fulltitle] logger.debug('UPDATED=\n' + str(item.channel_prefs)) filetools.write(tvshow_path, head_nfo + item.tojson()) @@ -249,8 +250,8 @@ def add_renumber_options(item, head_nfo, path): ret = None filename = filetools.join(config.get_data_path(), "settings_channels", item.channel + '_data.json') json_file = jsontools.load(filetools.read(filename)) - if 'TVSHOW_AUTORENUMBER' in json_file: - json = json_file['TVSHOW_AUTORENUMBER'] + if RENUMBER in json_file: + json = json_file[RENUMBER] if item.fulltitle in json: ret = json[item.fulltitle] return ret @@ -258,11 +259,11 @@ def add_renumber_options(item, head_nfo, path): def check_renumber_options(item): from platformcode.autorenumber import load, write for key in item.channel_prefs: - if 'TVSHOW_AUTORENUMBER' in item.channel_prefs[key]: + if RENUMBER in item.channel_prefs[key]: item.channel = key json = load(item) if not json or item.fulltitle not in json: - json[item.fulltitle] = item.channel_prefs[key]['TVSHOW_AUTORENUMBER'] + json[item.fulltitle] = item.channel_prefs[key][RENUMBER] write(item, json) # head_nfo, tvshow_item = read_nfo(filetools.join(item.context[0]['nfo'])) @@ -275,7 +276,7 @@ def filter_list(episodelist, action=None, path=None): # if xbmc.getCondVisibility('system.platform.windows') > 0: path = path.replace('smb:','').replace('/','\\') channel_prefs = {} lang_sel = quality_sel = show_title = channel ='' - # from core.support import dbg;dbg() + if action: tvshow_path = filetools.join(path, "tvshow.nfo") head_nfo, tvshow_item = read_nfo(tvshow_path) @@ -294,7 +295,7 @@ def filter_list(episodelist, action=None, path=None): renumber = add_renumber_options(episodelist[0], head_nfo, tvshow_path) if renumber: - channel_prefs['TVSHOW_AUTORENUMBER'] = renumber + channel_prefs[RENUMBER] = renumber if action == 'get_seasons': if 'favourite_language' not in channel_prefs: @@ -869,8 +870,7 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): if max_sea == high_sea and max_epi == high_epi and (tvshow_item.infoLabels["status"] == "Ended" or tvshow_item.infoLabels["status"] == "Canceled") and insertados == 0 and fallidos == 0 and not tvshow_item.local_episodes_path: tvshow_item.active = 0 # ... nor we will update it more logger.debug("%s [%s]: 'Finished' or 'Canceled' series. Periodic update is disabled" % (serie.contentSerieName, serie.channel)) - else: - tvshow_item.active = 1 + update_last = datetime.date.today() tvshow_item.update_last = update_last.strftime('%Y-%m-%d') update_next = datetime.date.today() + datetime.timedelta(days=int(tvshow_item.active))