Fix Autorenumber con paginazione in lista episodi
nota: Riscrivere autorenumber per migliorarne le prestazioni
This commit is contained in:
+4
-1
@@ -323,6 +323,7 @@ def scrape(func):
|
|||||||
itemlist = []
|
itemlist = []
|
||||||
|
|
||||||
args = func(*args)
|
args = func(*args)
|
||||||
|
log('STACK= ',inspect.stack()[1][3])
|
||||||
|
|
||||||
item = args['item']
|
item = args['item']
|
||||||
|
|
||||||
@@ -344,7 +345,7 @@ def scrape(func):
|
|||||||
typeActionDict = args['type_action_dict'] if 'type_action_dict' in args else {}
|
typeActionDict = args['type_action_dict'] if 'type_action_dict' in args else {}
|
||||||
typeContentDict = args['type_content_dict'] if 'type_content_dict' in args else {}
|
typeContentDict = args['type_content_dict'] if 'type_content_dict' in args else {}
|
||||||
debug = args['debug'] if 'debug' in args else False
|
debug = args['debug'] if 'debug' in args else False
|
||||||
if 'pagination' in args: pagination = args['pagination'] if args['pagination'] else 20
|
if 'pagination' in args and inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes']: pagination = args['pagination'] if args['pagination'] else 20
|
||||||
else: pagination = ''
|
else: pagination = ''
|
||||||
lang = args['deflang'] if 'deflang' in args else ''
|
lang = args['deflang'] if 'deflang' in args else ''
|
||||||
pag = item.page if item.page else 1 # pagination
|
pag = item.page if item.page else 1 # pagination
|
||||||
@@ -392,6 +393,8 @@ def scrape(func):
|
|||||||
action = item.action,
|
action = item.action,
|
||||||
contentType=item.contentType,
|
contentType=item.contentType,
|
||||||
title=typo(config.get_localized_string(30992), 'color kod bold'),
|
title=typo(config.get_localized_string(30992), 'color kod bold'),
|
||||||
|
fulltitle= item.fulltitle,
|
||||||
|
show= item.show,
|
||||||
url=item.url,
|
url=item.url,
|
||||||
args=item.args,
|
args=item.args,
|
||||||
page=pag + 1,
|
page=pag + 1,
|
||||||
|
|||||||
+37
-32
@@ -238,7 +238,7 @@ def renumber(itemlist, item='', typography=''):
|
|||||||
item.context = context(exist)
|
item.context = context(exist)
|
||||||
|
|
||||||
def renumeration (itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE):
|
def renumeration (itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE):
|
||||||
log()
|
log('EPISODE= ', EPISODE)
|
||||||
# Se ID è 0 salta la rinumerazione
|
# Se ID è 0 salta la rinumerazione
|
||||||
if ID == '0':
|
if ID == '0':
|
||||||
return itemlist
|
return itemlist
|
||||||
@@ -247,24 +247,26 @@ def renumeration (itemlist, item, typography, dict_series, ID, SEASON, EPISODE,
|
|||||||
elif SEASON == '0':
|
elif SEASON == '0':
|
||||||
EpisodeDict = {}
|
EpisodeDict = {}
|
||||||
for item in itemlist:
|
for item in itemlist:
|
||||||
number = scrapertoolsV2.find_single_match(item.title, r'\d+')
|
if config.get_localized_string(30992) not in item.title:
|
||||||
item.title = typo('0x' + number + ' - ', typography) + item.title
|
number = scrapertoolsV2.find_single_match(item.title, r'\d+')
|
||||||
|
item.title = typo('0x' + number + ' - ', typography) + item.title
|
||||||
|
|
||||||
|
|
||||||
# Usa la lista degli Episodi se esiste nel Json
|
# Usa la lista degli Episodi se esiste nel Json
|
||||||
|
|
||||||
elif EPISODE:
|
elif EPISODE:
|
||||||
EpisodeDict = json.loads(base64.b64decode(EPISODE))
|
EpisodeDict = json.loads(base64.b64decode(EPISODE))
|
||||||
|
log('EPISODE DICT= ', EpisodeDict)
|
||||||
|
|
||||||
# Controlla che la lista egli Episodi sia della stessa lunghezza di Itemlist
|
# Controlla che la lista egli Episodi sia della stessa lunghezza di Itemlist
|
||||||
if EpisodeDict == 'none':
|
if EpisodeDict == 'none':
|
||||||
return error(itemlist)
|
return error(itemlist)
|
||||||
if len(EpisodeDict) >= len(itemlist):
|
if len(EpisodeDict) >= len(itemlist) and EpisodeDict.has_key(scrapertoolsV2.find_single_match(itemlist[0].title, r'\d+')):
|
||||||
for item in itemlist:
|
for item in itemlist:
|
||||||
number = scrapertoolsV2.find_single_match(item.title, r'\d+')
|
if config.get_localized_string(30992) not in item.title:
|
||||||
log('TIPO NUMBER= ', type(number))
|
number = scrapertoolsV2.find_single_match(item.title, r'\d+')
|
||||||
number = int(number)
|
number = int(number) # if number !='0': number.lstrip('0')
|
||||||
item.title = typo(EpisodeDict[str(number)] + ' - ', typography) + item.title
|
item.title = typo(EpisodeDict[str(number)] + ' - ', typography) + item.title
|
||||||
else:
|
else:
|
||||||
make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE)
|
make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE)
|
||||||
|
|
||||||
@@ -276,7 +278,10 @@ def make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE
|
|||||||
log()
|
log()
|
||||||
page = 1
|
page = 1
|
||||||
EpList = []
|
EpList = []
|
||||||
EpisodeDict = {}
|
if EPISODE:
|
||||||
|
EpisodeDict = json.loads(base64.b64decode(EPISODE))
|
||||||
|
else:
|
||||||
|
EpisodeDict = {}
|
||||||
exist = True
|
exist = True
|
||||||
item.infoLabels['tvdb_id'] = ID
|
item.infoLabels['tvdb_id'] = ID
|
||||||
tvdb.set_infoLabels_item(item)
|
tvdb.set_infoLabels_item(item)
|
||||||
@@ -329,33 +334,33 @@ def make_list(itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE
|
|||||||
addiction = 0
|
addiction = 0
|
||||||
for item in itemlist:
|
for item in itemlist:
|
||||||
# Otiene Numerazione Episodi
|
# Otiene Numerazione Episodi
|
||||||
episode = int(scrapertoolsV2.find_single_match(item.title, r'\d+'))
|
if config.get_localized_string(30992) not in item.title:
|
||||||
log('EPISODE= ',episode)
|
episode = int(scrapertoolsV2.find_single_match(item.title, r'\d+'))
|
||||||
number = episode + FirstOfSeason - addiction
|
log('EPISODE= ',episode)
|
||||||
count = number + addiction
|
number = episode + FirstOfSeason - addiction
|
||||||
# find = episode + FirstOfSeason
|
count = number + addiction
|
||||||
# log('FIND= ',find, ' ',str(episode) + ' ' + str(FirstOfSeason))
|
# find = episode + FirstOfSeason
|
||||||
# Crea Dizionario Episodi
|
# log('FIND= ',find, ' ',str(episode) + ' ' + str(FirstOfSeason))
|
||||||
|
# Crea Dizionario Episodi
|
||||||
|
|
||||||
# log(episode, ' ', number, ' ', count)
|
if episode == 0:
|
||||||
if episode == 0:
|
EpisodeDict[str(episode)] = str(complete[regular[FirstOfSeason+1][2]][0])
|
||||||
EpisodeDict[str(episode)] = str(complete[regular[FirstOfSeason+1][2]][0])
|
elif addiction < len(SPECIAL):
|
||||||
elif addiction < len(SPECIAL):
|
if episode in SPECIAL:
|
||||||
if episode in SPECIAL:
|
season = complete[regular[count][2]][0]
|
||||||
season = complete[regular[count][2]][0]
|
EpisodeDict[str(episode)] = str(complete[regular[count][2]][0]) if season.startswith( '0' ) else '0x' + platformtools.dialog_numeric(0, item.title + '?', '')
|
||||||
EpisodeDict[str(episode)] = str(complete[regular[count][2]][0]) if season.startswith( '0' ) else '0x' + platformtools.dialog_numeric(0, item.title + '?', '')
|
addiction = addiction + 1
|
||||||
addiction = addiction + 1
|
else:
|
||||||
else:
|
EpisodeDict[str(episode)] = str(regular[number][0])
|
||||||
|
elif number <= len(regular):
|
||||||
EpisodeDict[str(episode)] = str(regular[number][0])
|
EpisodeDict[str(episode)] = str(regular[number][0])
|
||||||
elif number <= len(regular):
|
else:
|
||||||
EpisodeDict[str(episode)] = str(regular[number][0])
|
try: EpisodeDict[str(episode)] = str(complete[regular[number+2][2]][0])
|
||||||
else:
|
except: EpisodeDict[str(episode)] = '0x0'
|
||||||
try: EpisodeDict[str(episode)] = str(complete[regular[number+2][2]][0])
|
|
||||||
except: EpisodeDict[str(episode)] = '0x0'
|
|
||||||
|
|
||||||
# Aggiunge numerazione agli Episodi
|
# Aggiunge numerazione agli Episodi
|
||||||
|
|
||||||
item.title = typo(EpisodeDict[str(episode)] + ' - ', typography) + item.title
|
item.title = typo(EpisodeDict[str(episode)] + ' - ', typography) + item.title
|
||||||
|
|
||||||
# Scrive Dizionario Episodi sul json
|
# Scrive Dizionario Episodi sul json
|
||||||
EpisodeDict = base64.b64encode(json.dumps(EpisodeDict))
|
EpisodeDict = base64.b64encode(json.dumps(EpisodeDict))
|
||||||
|
|||||||
Reference in New Issue
Block a user