This commit is contained in:
Alhaziel01
2021-02-02 15:38:10 +01:00
parent a9c6dac6f4
commit 3ecc17db98
2 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -540,7 +540,7 @@ def get_nfo(item, search_groups=False):
path = filetools.join(config.get_data_path(), "settings_channels", item.channel + "_data.json") path = filetools.join(config.get_data_path(), "settings_channels", item.channel + "_data.json")
if filetools.exists(path): if filetools.exists(path):
g = jsontools.load(filetools.read(path)).get(RENUMBER,{}).get(item.fulltitle.strip(),{}).get(GROUP,'') 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) groups = get_groups(item)
+11 -11
View File
@@ -14,6 +14,7 @@ from core import filetools, scraper, scrapertools
from core.item import Item from core.item import Item
from lib import generictools from lib import generictools
from platformcode import config, logger, platformtools from platformcode import config, logger, platformtools
from platformcode.autorenumber import RENUMBER
FOLDER_MOVIES = config.get_setting("folder_movies") FOLDER_MOVIES = config.get_setting("folder_movies")
FOLDER_TVSHOWS = config.get_setting("folder_tvshows") 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') filename = filetools.join(config.get_data_path(), "settings_channels", channel + '_data.json')
json_file = jsontools.load(filetools.read(filename)) json_file = jsontools.load(filetools.read(filename))
if 'TVSHOW_AUTORENUMBER' in json_file: if RENUMBER in json_file:
json = json_file['TVSHOW_AUTORENUMBER'] json = json_file[RENUMBER]
if item.fulltitle in json: 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)) logger.debug('UPDATED=\n' + str(item.channel_prefs))
filetools.write(tvshow_path, head_nfo + item.tojson()) filetools.write(tvshow_path, head_nfo + item.tojson())
@@ -249,8 +250,8 @@ def add_renumber_options(item, head_nfo, path):
ret = None ret = None
filename = filetools.join(config.get_data_path(), "settings_channels", item.channel + '_data.json') filename = filetools.join(config.get_data_path(), "settings_channels", item.channel + '_data.json')
json_file = jsontools.load(filetools.read(filename)) json_file = jsontools.load(filetools.read(filename))
if 'TVSHOW_AUTORENUMBER' in json_file: if RENUMBER in json_file:
json = json_file['TVSHOW_AUTORENUMBER'] json = json_file[RENUMBER]
if item.fulltitle in json: if item.fulltitle in json:
ret = json[item.fulltitle] ret = json[item.fulltitle]
return ret return ret
@@ -258,11 +259,11 @@ def add_renumber_options(item, head_nfo, path):
def check_renumber_options(item): def check_renumber_options(item):
from platformcode.autorenumber import load, write from platformcode.autorenumber import load, write
for key in item.channel_prefs: for key in item.channel_prefs:
if 'TVSHOW_AUTORENUMBER' in item.channel_prefs[key]: if RENUMBER in item.channel_prefs[key]:
item.channel = key item.channel = key
json = load(item) json = load(item)
if not json or item.fulltitle not in json: 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) write(item, json)
# head_nfo, tvshow_item = read_nfo(filetools.join(item.context[0]['nfo'])) # 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('/','\\') # if xbmc.getCondVisibility('system.platform.windows') > 0: path = path.replace('smb:','').replace('/','\\')
channel_prefs = {} channel_prefs = {}
lang_sel = quality_sel = show_title = channel ='' lang_sel = quality_sel = show_title = channel =''
# from core.support import dbg;dbg()
if action: if action:
tvshow_path = filetools.join(path, "tvshow.nfo") tvshow_path = filetools.join(path, "tvshow.nfo")
head_nfo, tvshow_item = read_nfo(tvshow_path) 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) renumber = add_renumber_options(episodelist[0], head_nfo, tvshow_path)
if renumber: if renumber:
channel_prefs['TVSHOW_AUTORENUMBER'] = renumber channel_prefs[RENUMBER] = renumber
if action == 'get_seasons': if action == 'get_seasons':
if 'favourite_language' not in channel_prefs: 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: 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 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)) 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() update_last = datetime.date.today()
tvshow_item.update_last = update_last.strftime('%Y-%m-%d') tvshow_item.update_last = update_last.strftime('%Y-%m-%d')
update_next = datetime.date.today() + datetime.timedelta(days=int(tvshow_item.active)) update_next = datetime.date.today() + datetime.timedelta(days=int(tvshow_item.active))