ottimizzati menu canale per ricerca globale

This commit is contained in:
marco
2020-05-28 19:09:57 +02:00
parent 18c000a44e
commit d8e1fa0cd8
+18 -9
View File
@@ -668,10 +668,11 @@ def stayonline(id):
return data return data
def menuItem(itemlist, filename, title='', action='', url='', contentType='movie', args=[]): def menuItem(itemlist, filename, title='', action='', url='', contentType='movie', args=[], style=True):
# Function to simplify menu creation # Function to simplify menu creation
# Call typo function # Call typo function
if style:
title = typo(title) title = typo(title)
if contentType == 'movie': extra = 'movie' if contentType == 'movie': extra = 'movie'
@@ -688,6 +689,7 @@ def menuItem(itemlist, filename, title='', action='', url='', contentType='movie
)) ))
# Apply auto Thumbnails at the menus # Apply auto Thumbnails at the menus
if style:
from channelselector import thumb from channelselector import thumb
thumb(itemlist) thumb(itemlist)
return itemlist return itemlist
@@ -704,12 +706,13 @@ def menu(func):
list_quality = func.__globals__['list_quality'] if 'list_quality' in func.__globals__ else ['default'] list_quality = func.__globals__['list_quality'] if 'list_quality' in func.__globals__ else ['default']
log('LIST QUALITY', list_quality) log('LIST QUALITY', list_quality)
filename = func.__module__.split('.')[1] filename = func.__module__.split('.')[1]
global_search = False single_search = False
# listUrls = ['film', 'filmSub', 'tvshow', 'tvshowSub', 'anime', 'animeSub', 'search', 'top', 'topSub'] # listUrls = ['film', 'filmSub', 'tvshow', 'tvshowSub', 'anime', 'animeSub', 'search', 'top', 'topSub']
listUrls = ['top', 'film', 'tvshow', 'anime', 'search'] listUrls = ['top', 'film', 'tvshow', 'anime', 'search']
listUrls_extra = [] listUrls_extra = []
dictUrl = {} dictUrl = {}
global_search = 'get_channel_results' in inspect.stack()[1][3]
# Main options # Main options
itemlist = [] itemlist = []
@@ -722,10 +725,11 @@ def menu(func):
if name == 'anime': title = 'Anime' if name == 'anime': title = 'Anime'
if name == 'search' and dictUrl[name] is not None: if name == 'search' and dictUrl[name] is not None:
global_search = True single_search = True
# Make TOP MENU # Make TOP MENU
elif name == 'top' and dictUrl[name] is not None: elif name == 'top' and dictUrl[name] is not None:
if not global_search:
for sub, var in dictUrl['top']: for sub, var in dictUrl['top']:
menuItem(itemlist, filename, menuItem(itemlist, filename,
title = sub + ' italic bold', title = sub + ' italic bold',
@@ -736,8 +740,12 @@ def menu(func):
# Make MAIN MENU # Make MAIN MENU
elif dictUrl[name] is not None: elif dictUrl[name] is not None:
if len(dictUrl[name]) == 0: url = '' if len(dictUrl[name]) == 0:
else: url = dictUrl[name][0] if type(dictUrl[name][0]) is not tuple and len(dictUrl[name][0]) > 0 else '' url = ''
else:
url = dictUrl[name][0] if type(dictUrl[name][0]) is not tuple and len(dictUrl[name][0]) > 0 else ''
if not global_search:
menuItem(itemlist, filename, menuItem(itemlist, filename,
title + ' bullet bold', 'peliculas', title + ' bullet bold', 'peliculas',
host + url, host + url,
@@ -753,9 +761,10 @@ def menu(func):
args=var[2] if len(var) > 2 else '', args=var[2] if len(var) > 2 else '',
contentType= var[3] if len(var) > 3 else 'movie' if name == 'film' else 'tvshow') contentType= var[3] if len(var) > 3 else 'movie' if name == 'film' else 'tvshow')
# add search menu for category # add search menu for category
if 'search' not in args: menuItem(itemlist, filename, config.get_localized_string(70741) % title + ' … submenu bold', 'search', host + url, contentType='movie' if name == 'film' else 'tvshow') if 'search' not in args: menuItem(itemlist, filename, config.get_localized_string(70741) % title + ' … submenu bold', 'search', host + url, contentType='movie' if name == 'film' else 'tvshow', style=not global_search)
# Make EXTRA MENU (on bottom) # Make EXTRA MENU (on bottom)
if not global_search:
for name, var in args.items(): for name, var in args.items():
if name not in listUrls and name != 'item': if name not in listUrls and name != 'item':
listUrls_extra.append(name) listUrls_extra.append(name)
@@ -769,10 +778,10 @@ def menu(func):
args=var[2] if len(var) > 2 else '', args=var[2] if len(var) > 2 else '',
contentType= var[3] if len(var) > 3 else 'movie',) contentType= var[3] if len(var) > 3 else 'movie',)
if global_search: if single_search:
menuItem(itemlist, filename, config.get_localized_string(70741) % '… bold', 'search', host + dictUrl['search']) menuItem(itemlist, filename, config.get_localized_string(70741) % '… bold', 'search', host + dictUrl['search'], style=not global_search)
if 'get_channel_results' not in inspect.stack()[1][3]: if not global_search:
autoplay.init(item.channel, list_servers, list_quality) autoplay.init(item.channel, list_servers, list_quality)
autoplay.show_option(item.channel, itemlist) autoplay.show_option(item.channel, itemlist)
channel_config(item, itemlist) channel_config(item, itemlist)