test ricerca globale
This commit is contained in:
@@ -688,12 +688,6 @@ def menuItem(itemlist, filename, title='', action='', url='', contentType='movie
|
||||
contentType = contentType
|
||||
))
|
||||
|
||||
# Apply auto Thumbnails at the menus
|
||||
if style:
|
||||
from channelselector import thumb
|
||||
thumb(itemlist)
|
||||
return itemlist
|
||||
|
||||
|
||||
def menu(func):
|
||||
def wrapper(*args):
|
||||
@@ -701,6 +695,7 @@ def menu(func):
|
||||
args = func(*args)
|
||||
|
||||
item = args['item']
|
||||
log(item.channel + ' start')
|
||||
host = func.__globals__['host']
|
||||
list_servers = func.__globals__['list_servers'] if 'list_servers' in func.__globals__ else ['directo']
|
||||
list_quality = func.__globals__['list_quality'] if 'list_quality' in func.__globals__ else ['default']
|
||||
@@ -712,7 +707,7 @@ def menu(func):
|
||||
listUrls_extra = []
|
||||
dictUrl = {}
|
||||
|
||||
global_search = 'get_channel_results' in inspect.stack()[1][3]
|
||||
global_search = item.global_search
|
||||
|
||||
# Main options
|
||||
itemlist = []
|
||||
@@ -786,6 +781,10 @@ def menu(func):
|
||||
autoplay.show_option(item.channel, itemlist)
|
||||
channel_config(item, itemlist)
|
||||
|
||||
# Apply auto Thumbnails at the menus
|
||||
from channelselector import thumb
|
||||
thumb(itemlist)
|
||||
log(item.channel + ' end')
|
||||
return itemlist
|
||||
|
||||
return wrapper
|
||||
|
||||
@@ -201,8 +201,24 @@ def channel_search(item):
|
||||
str(searching_titles))
|
||||
config.set_setting('tmdb_active', False)
|
||||
|
||||
search_action_list = []
|
||||
module_dict = {}
|
||||
logger.info('start import')
|
||||
for ch in channel_list:
|
||||
# ch_params = channeltools.get_channel_parameters(ch)
|
||||
module = __import__('channels.%s' % ch, fromlist=["channels.%s" % ch])
|
||||
mainlist = getattr(module, 'mainlist')(Item(channel=ch, global_search=True))
|
||||
|
||||
module_dict[ch] = module
|
||||
search_action_list.extend([elem for elem in mainlist if
|
||||
elem.action == "search" and (item.mode == 'all' or elem.contentType == item.mode)])
|
||||
logger.info('end import')
|
||||
with futures.ThreadPoolExecutor(max_workers=set_workers()) as executor:
|
||||
c_results = [executor.submit(get_channel_results, ch, item) for ch in channel_list]
|
||||
c_results = []
|
||||
for search_action in search_action_list:
|
||||
c_results.append(executor.submit(get_channel_results, item, module_dict, search_action))
|
||||
if progress.iscanceled():
|
||||
break
|
||||
|
||||
for res in futures.as_completed(c_results):
|
||||
cnt += 1
|
||||
@@ -295,21 +311,14 @@ def channel_search(item):
|
||||
return valid + results
|
||||
|
||||
|
||||
def get_channel_results(ch, item):
|
||||
def get_channel_results(item, module_dict, search_action):
|
||||
ch = search_action.channel
|
||||
max_results = 10
|
||||
results = list()
|
||||
module = module_dict[ch]
|
||||
|
||||
try:
|
||||
ch_params = channeltools.get_channel_parameters(ch)
|
||||
|
||||
module = __import__('channels.%s' % ch_params["channel"], fromlist=["channels.%s" % ch_params["channel"]])
|
||||
mainlist = getattr(module, 'mainlist')(Item(channel=ch_params["channel"]))
|
||||
search_action = [elem for elem in mainlist if elem.action == "search" and (item.mode == 'all' or elem.contentType == item.mode)]
|
||||
|
||||
if search_action:
|
||||
for search_ in search_action:
|
||||
results.extend(module.search(search_, item.text))
|
||||
else:
|
||||
results.extend(module.search(item, item.text))
|
||||
results.extend(module.search(search_action, item.text))
|
||||
|
||||
if len(results) < 0 and len(results) < max_results and item.mode != 'all':
|
||||
|
||||
|
||||
Reference in New Issue
Block a user