Backup Rinumerazione in tvshow.info
This commit is contained in:
@@ -234,12 +234,54 @@ def save_movie(item):
|
|||||||
p_dialog.close()
|
p_dialog.close()
|
||||||
return 0, 0, -1
|
return 0, 0, -1
|
||||||
|
|
||||||
|
def update_renumber_options(item, head_nfo, path):
|
||||||
|
from core import jsontools
|
||||||
|
# from core.support import dbg;dbg()
|
||||||
|
tvshow_path = filetools.join(path, 'tvshow.nfo')
|
||||||
|
for channel in item.channel_prefs:
|
||||||
|
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 item.fulltitle in json:
|
||||||
|
item.channel_prefs[channel]['TVSHOW_AUTORENUMBER'] = json[item.fulltitle]
|
||||||
|
logger.info('UPDATED=\n' + str(item.channel_prefs))
|
||||||
|
filetools.write(tvshow_path, head_nfo + item.tojson())
|
||||||
|
|
||||||
|
def add_renumber_options(item, head_nfo, path):
|
||||||
|
from core import jsontools
|
||||||
|
# from core.support import dbg;dbg()
|
||||||
|
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 item.fulltitle in json:
|
||||||
|
ret = json[item.fulltitle]
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def check_renumber_options(item):
|
||||||
|
from specials.autorenumber import load, write
|
||||||
|
for key in item.channel_prefs:
|
||||||
|
if 'TVSHOW_AUTORENUMBER' 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']
|
||||||
|
write(item, json)
|
||||||
|
|
||||||
|
# head_nfo, tvshow_item = read_nfo(filetools.join(item.context[0]['nfo']))
|
||||||
|
# if tvshow_item['channel_prefs'][item.fullti]
|
||||||
|
|
||||||
|
|
||||||
def filter_list(episodelist, action=None, path=None):
|
def filter_list(episodelist, action=None, path=None):
|
||||||
# if path: path = path.decode('utf8')
|
# if path: path = path.decode('utf8')
|
||||||
# import xbmc
|
# import xbmc
|
||||||
# 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)
|
||||||
@@ -253,8 +295,13 @@ def filter_list(episodelist, action=None, path=None):
|
|||||||
filetools.remove(filetools.join(path, File))
|
filetools.remove(filetools.join(path, File))
|
||||||
if channel not in tvshow_item.channel_prefs:
|
if channel not in tvshow_item.channel_prefs:
|
||||||
tvshow_item.channel_prefs[channel] = {}
|
tvshow_item.channel_prefs[channel] = {}
|
||||||
|
|
||||||
channel_prefs = tvshow_item.channel_prefs[channel]
|
channel_prefs = tvshow_item.channel_prefs[channel]
|
||||||
|
|
||||||
|
renumber = add_renumber_options(episodelist[0], head_nfo, tvshow_path)
|
||||||
|
if renumber:
|
||||||
|
channel_prefs['TVSHOW_AUTORENUMBER'] = renumber
|
||||||
|
|
||||||
if action == 'get_seasons':
|
if action == 'get_seasons':
|
||||||
if 'favourite_language' not in channel_prefs:
|
if 'favourite_language' not in channel_prefs:
|
||||||
channel_prefs['favourite_language'] = ''
|
channel_prefs['favourite_language'] = ''
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ def renumber(itemlist, item='', typography=''):
|
|||||||
if item:
|
if item:
|
||||||
item.channel = item.from_channel if item.from_channel else item.channel
|
item.channel = item.from_channel if item.from_channel else item.channel
|
||||||
title = item.fulltitle.rstrip()
|
title = item.fulltitle.rstrip()
|
||||||
|
if item.channel in item.channel_prefs and TAG_TVSHOW_RENUMERATE in item.channel_prefs[item.channel] and title not in dict_series:
|
||||||
|
from core.videolibrarytools import check_renumber_options
|
||||||
|
from specials.videolibrary import update_videolibrary
|
||||||
|
check_renumber_options(item)
|
||||||
|
update_videolibrary(item)
|
||||||
|
|
||||||
if inspect.stack()[2][3] == 'find_episodes':
|
if inspect.stack()[2][3] == 'find_episodes':
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|||||||
@@ -318,6 +318,8 @@ def get_seasons(item):
|
|||||||
itemlist = []
|
itemlist = []
|
||||||
dict_temp = {}
|
dict_temp = {}
|
||||||
|
|
||||||
|
videolibrarytools.check_renumber_options(item)
|
||||||
|
|
||||||
raiz, carpetas_series, ficheros = next(filetools.walk(item.path))
|
raiz, carpetas_series, ficheros = next(filetools.walk(item.path))
|
||||||
|
|
||||||
# Menu contextual: Releer tvshow.nfo
|
# Menu contextual: Releer tvshow.nfo
|
||||||
@@ -441,6 +443,7 @@ def findvideos(item):
|
|||||||
from specials import autoplay
|
from specials import autoplay
|
||||||
logger.info()
|
logger.info()
|
||||||
# logger.debug("item:\n" + item.tostring('\n'))
|
# logger.debug("item:\n" + item.tostring('\n'))
|
||||||
|
videolibrarytools.check_renumber_options(item)
|
||||||
|
|
||||||
itemlist = []
|
itemlist = []
|
||||||
list_canales = {}
|
list_canales = {}
|
||||||
|
|||||||
@@ -26,10 +26,12 @@ from platformcode import updater
|
|||||||
|
|
||||||
|
|
||||||
def update(path, p_dialog, i, t, serie, overwrite):
|
def update(path, p_dialog, i, t, serie, overwrite):
|
||||||
logger.info("Actualizando " + path)
|
logger.info("Updating " + path)
|
||||||
insertados_total = 0
|
insertados_total = 0
|
||||||
|
|
||||||
head_nfo, it = videolibrarytools.read_nfo(path + '/tvshow.nfo')
|
head_nfo, it = videolibrarytools.read_nfo(path + '/tvshow.nfo')
|
||||||
|
# videolibrarytools.check_renumber_options(it)
|
||||||
|
videolibrarytools.update_renumber_options(it, head_nfo, path)
|
||||||
category = serie.category
|
category = serie.category
|
||||||
|
|
||||||
# logger.debug("%s: %s" %(serie.contentSerieName,str(list_canales) ))
|
# logger.debug("%s: %s" %(serie.contentSerieName,str(list_canales) ))
|
||||||
@@ -107,7 +109,7 @@ def update(path, p_dialog, i, t, serie, overwrite):
|
|||||||
|
|
||||||
|
|
||||||
def check_for_update(overwrite=True):
|
def check_for_update(overwrite=True):
|
||||||
logger.info("Actualizando series...")
|
logger.info("Update Series...")
|
||||||
p_dialog = None
|
p_dialog = None
|
||||||
serie_actualizada = False
|
serie_actualizada = False
|
||||||
update_when_finished = False
|
update_when_finished = False
|
||||||
|
|||||||
Reference in New Issue
Block a user