Sostituito parzialmente inspect.stack
This commit is contained in:
@@ -529,7 +529,7 @@ def scrape(func):
|
|||||||
debug = args.get('debug', False)
|
debug = args.get('debug', False)
|
||||||
debugBlock = args.get('debugBlock', False)
|
debugBlock = args.get('debugBlock', False)
|
||||||
disabletmdb = args.get('disabletmdb', False)
|
disabletmdb = args.get('disabletmdb', False)
|
||||||
if 'pagination' in args and inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes']: pagination = args['pagination'] if args['pagination'] else 20
|
if 'pagination' in args and inspect.currentframe().f_back.f_code.co_name not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes']: pagination = args['pagination'] if args['pagination'] else 20
|
||||||
else: pagination = ''
|
else: pagination = ''
|
||||||
lang = args.get('deflang', '')
|
lang = args.get('deflang', '')
|
||||||
sceneTitle = args.get('sceneTitle')
|
sceneTitle = args.get('sceneTitle')
|
||||||
@@ -614,19 +614,19 @@ def scrape(func):
|
|||||||
itemlist = [i for i in itemlist if i.action not in ['add_pelicula_to_library', 'add_serie_to_library']]
|
itemlist = [i for i in itemlist if i.action not in ['add_pelicula_to_library', 'add_serie_to_library']]
|
||||||
logger.debug(item.channel + ' scraping time ' + ':', time()-scrapingTime)
|
logger.debug(item.channel + ' scraping time ' + ':', time()-scrapingTime)
|
||||||
|
|
||||||
if anime and inspect.stack()[1][3] not in ['find_episodes']:
|
if anime and inspect.currentframe().f_back.f_code.co_name not in ['find_episodes']:
|
||||||
from platformcode import autorenumber
|
from platformcode import autorenumber
|
||||||
if function == 'episodios': autorenumber.start(itemlist, item)
|
if function == 'episodios': autorenumber.start(itemlist, item)
|
||||||
else: autorenumber.start(itemlist)
|
else: autorenumber.start(itemlist)
|
||||||
|
|
||||||
if itemlist and action != 'play' and 'patronMenu' not in args and 'patronGenreMenu' not in args \
|
if itemlist and action != 'play' and 'patronMenu' not in args and 'patronGenreMenu' not in args \
|
||||||
and not stackCheck(['add_tvshow', 'get_newest']) and (function not in ['episodios', 'mainlist'] \
|
and not stackCheck(['add_tvshow', 'get_newest']) and (function not in ['episodios', 'mainlist']
|
||||||
or (function in ['episodios', 'seasons'] and config.get_setting('episode_info') and itemlist[0].season)):
|
or (function in ['episodios', 'seasons'] and config.get_setting('episode_info') and itemlist[0].season)):
|
||||||
# dbg()
|
# dbg()
|
||||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||||
|
|
||||||
if not group and not args.get('groupExplode') and ((pagination and len(matches) <= pag * pagination) or not pagination): # next page with pagination
|
if not group and not args.get('groupExplode') and ((pagination and len(matches) <= pag * pagination) or not pagination): # next page with pagination
|
||||||
if patronNext and inspect.stack()[1][3] not in ['newest'] and len(inspect.stack()) > 2 and inspect.stack()[2][3] not in ['get_channel_results']:
|
if patronNext and inspect.currentframe().f_back.f_code.co_name not in ['newest'] and len(inspect.stack()) > 2 and inspect.stack()[2][3] not in ['get_channel_results']:
|
||||||
nextPage(itemlist, item, data, patronNext, function)
|
nextPage(itemlist, item, data, patronNext, function)
|
||||||
|
|
||||||
# for it in itemlist:
|
# for it in itemlist:
|
||||||
@@ -639,7 +639,7 @@ def scrape(func):
|
|||||||
|
|
||||||
# next page for pagination
|
# next page for pagination
|
||||||
if pagination and len(matches) > pag * pagination and not search:
|
if pagination and len(matches) > pag * pagination and not search:
|
||||||
if inspect.stack()[1][3] not in ['newest','get_newest']:
|
if inspect.currentframe().f_back.f_code.co_name not in ['newest','get_newest']:
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
Item(channel=item.channel,
|
Item(channel=item.channel,
|
||||||
action = item.action,
|
action = item.action,
|
||||||
@@ -653,7 +653,7 @@ def scrape(func):
|
|||||||
thumbnail=thumb(),
|
thumbnail=thumb(),
|
||||||
prevthumb=item.prevthumb if item.prevthumb else item.thumbnail))
|
prevthumb=item.prevthumb if item.prevthumb else item.thumbnail))
|
||||||
|
|
||||||
if inspect.stack()[1][3] not in ['find_episodes']:
|
if inspect.currentframe().f_back.f_code.co_name not in ['find_episodes']:
|
||||||
if addVideolibrary and (item.infoLabels["title"] or item.fulltitle):
|
if addVideolibrary and (item.infoLabels["title"] or item.fulltitle):
|
||||||
# item.fulltitle = item.infoLabels["title"]
|
# item.fulltitle = item.infoLabels["title"]
|
||||||
videolibrary(itemlist, item, function=function)
|
videolibrary(itemlist, item, function=function)
|
||||||
@@ -1651,9 +1651,10 @@ def check_trakt(itemlist):
|
|||||||
|
|
||||||
|
|
||||||
def stackCheck(values):
|
def stackCheck(values):
|
||||||
stacks = [s[3] for s in inspect.stack()]
|
logger.debug()
|
||||||
logger.debug('STAKS', stacks)
|
frame = inspect.currentframe()
|
||||||
if type(values) == str:
|
while frame:
|
||||||
return values in stacks
|
if frame.f_code.co_name in values:
|
||||||
else:
|
return True
|
||||||
return any(v in values for v in stacks)
|
frame = frame.f_back
|
||||||
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user