From 0e22056e48fb814ea797cb453f04e35197c16aff Mon Sep 17 00:00:00 2001 From: marco Date: Sat, 30 May 2020 14:13:23 +0200 Subject: [PATCH] link diretti ai server in ricerca globale -> cerca film --- channels/filmsenzalimiticc.py | 4 ---- core/support.py | 2 +- specials/autoplay.py | 2 ++ specials/search.py | 38 ++++++++++++++++++++++++++++++----- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/channels/filmsenzalimiticc.py b/channels/filmsenzalimiticc.py index 689a9a1a..25ad2875 100644 --- a/channels/filmsenzalimiticc.py +++ b/channels/filmsenzalimiticc.py @@ -239,10 +239,6 @@ def findvideos(item): # Questa def. deve sempre essere nominata findvideos Item(channel=item.channel, title='[COLOR lightblue][B]Aggiungi alla videoteca[/B][/COLOR]', url=item.url, action='add_pelicula_to_library', extra='findservers', contentTitle=item.contentTitle)) - # Necessario per filtrare i Link - if checklinks: - itemlist = servertools.check_list_links(itemlist, checklinks_number) - # Necessario per FilterTools # itemlist = filtertools.get_links(itemlist, item, list_language) diff --git a/core/support.py b/core/support.py index 2f5b76f6..be8789fc 100755 --- a/core/support.py +++ b/core/support.py @@ -1181,7 +1181,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru AP, HS = autoplay.get_channel_AP_HS(item) # Check Links - if not AP and (config.get_setting('checklinks') or config.get_setting('checklinks', item.channel)): + if not AP and not item.global_search and (config.get_setting('checklinks') or config.get_setting('checklinks', item.channel)): if config.get_setting('checklinks', item.channel): checklinks_number = config.get_setting('checklinks_number', item.channel) elif config.get_setting('checklinks'): diff --git a/specials/autoplay.py b/specials/autoplay.py index 3f2ea054..71e588af 100644 --- a/specials/autoplay.py +++ b/specials/autoplay.py @@ -90,6 +90,8 @@ def start(itemlist, item): :param item: item (the main item of the channel) :return: try to auto-reproduce, in case of failure it returns the itemlist that it received in the beginning ''' + if item.global_search: + return itemlist logger.info() global PLAYED diff --git a/specials/search.py b/specials/search.py index e554a0d3..0b2fa194 100644 --- a/specials/search.py +++ b/specials/search.py @@ -266,12 +266,11 @@ def channel_search(item): if len(value) == 1: if not value[0].action or config.get_localized_string(70006).lower() in value[0].title.lower(): continue - tmdb.set_infoLabels_itemlist(value, True, forced=True) for elem in value: if not elem.infoLabels.get('year', ""): elem.infoLabels['year'] = '-' - tmdb.set_infoLabels_item(elem, True) - + tmdb.set_infoLabels_itemlist(value, True, forced=True) + for elem in value: if elem.infoLabels['tmdb_id'] == searched_id: elem.from_channel = key if not config.get_setting('unify'): @@ -312,14 +311,30 @@ def channel_search(item): results.append(Item(channel='search', title=title, action='get_from_temp', thumbnail=ch_thumb, itemlist=[ris.tourl() for ris in grouped], plot=plot, page=1)) + progress.close() + # "All Together" and movie mode -> search servers + if config.get_setting('result_mode') == 1 and mode == 'movie': + progress = platformtools.dialog_progress(config.get_localized_string(30993) % item.title, config.get_localized_string(60683)) + valid_servers = [] + with futures.ThreadPoolExecutor(max_workers=set_workers()) as executor: + c_results = [executor.submit(get_servers, v, module_dict) for v in valid] + completed = 0 + for res in futures.as_completed(c_results): + if progress.iscanceled(): + break + if res.result(): + completed += 1 + valid_servers.extend(res.result()) + progress.update(old_div(completed * 100, len(valid))) + valid = valid_servers + progress.close() # send_to_temp(to_temp) - config.set_setting('tmdb_active', True) results = sorted(results, key=lambda it: it.title) results_statistic = config.get_localized_string(59972) % (item.title, time.time() - start) - if item.mode == 'all': + if mode == 'all': results.insert(0, Item(title=typo(results_statistic, 'color kod bold'), thumbnail=get_thumb('search.png'))) else: valid.insert(0, Item(title=typo(results_statistic, 'color kod bold'), thumbnail=get_thumb('search.png'))) @@ -352,6 +367,19 @@ def get_channel_results(item, module_dict, search_action): return [search_action, results] +def get_servers(item, module_dict): + item.global_search = True + ch = item.channel + results = list() + module = module_dict[ch] + try: + results = getattr(module, item.action)(item) + except: + import traceback + logger.error(traceback.format_exc()) + return [r.clone(title=r.title + typo(item.channel, '_ [] color kod')) for r in results if r.action == 'play'] + + def get_info(itemlist): logger.info() tmdb.set_infoLabels_itemlist(itemlist, True, forced=True)