From 823a9f4f18755c79ba3e251a2df1beae90c8fd27 Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Sat, 21 Dec 2019 15:42:38 +0100 Subject: [PATCH] Ulteriori Impostazioni per ricerca Globale --- platformcode/launcher.py | 7 ++++--- specials/search.json | 9 +++++++++ specials/search.py | 40 ++++++++++++++++++++++++---------------- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/platformcode/launcher.py b/platformcode/launcher.py index ee917c5c..c28b32b3 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -270,9 +270,10 @@ def run(item=None): # Special action for searching, first asks for the words then call the "search" function elif item.action == "search": logger.info("item.action=%s" % item.action.upper()) - - last_search = channeltools.get_channel_setting('Last_searched', 'search', '') - + if channeltools.get_channel_setting('last_search', 'search'): + last_search = channeltools.get_channel_setting('Last_searched', 'search', '') + else: + last_search = '' tecleado = platformtools.dialog_input(last_search) if tecleado is not None: channeltools.set_channel_setting('Last_searched', tecleado, 'search') diff --git a/specials/search.json b/specials/search.json index cda48425..0db387a0 100644 --- a/specials/search.json +++ b/specials/search.json @@ -29,6 +29,15 @@ "40" ] }, + { + "id": "result_mode", + "type": "list", + "label": "@60657", + "default": 0, + "enabled": true, + "visible": true, + "lvalues": ["@60675","@60676"] + }, { "id": "thread_number", "type": "list", diff --git a/specials/search.py b/specials/search.py index d1a6b6f4..79269499 100755 --- a/specials/search.py +++ b/specials/search.py @@ -244,7 +244,12 @@ def channel_search(item): if it in valid: continue if mode == 'all' or (it.contentType and mode == it.contentType): - grouped.append(it) + if config.get_setting('result_mode', 'search') != 0: + if config.get_localized_string(30992) not in it.title: + it.title += typo(ch_name,'_ [] color kod bold') + results.append(it) + else: + grouped.append(it) elif (mode == 'movie' and it.contentTitle) or (mode == 'tvshow' and (it.contentSerieName or it.show)): grouped.append(it) else: @@ -253,28 +258,31 @@ def channel_search(item): if not grouped: continue # to_temp[key] = grouped + if config.get_setting('result_mode', 'search') == 0: + if not config.get_setting('unify'): + title = typo(ch_name,'bold') + typo(str(len(grouped)), '_ [] color kod bold') + else: + title = typo('%s %s' % (len(grouped), config.get_localized_string(70695)), 'bold') + res_count += len(grouped) + plot='' - if not config.get_setting('unify'): - title = typo(ch_name,'bold') + typo(str(len(grouped)), '_ [] color kod bold') - else: - title = typo('%s %s' % (len(grouped), config.get_localized_string(70695)), 'bold') - res_count += len(grouped) - plot='' - for it in grouped: - plot += it.title +'\n' - ch_thumb = channeltools.get_channel_parameters(key)['thumbnail'] - 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)) + for it in grouped: + plot += it.title +'\n' + ch_thumb = channeltools.get_channel_parameters(key)['thumbnail'] + 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)) + results = sorted(results, key=lambda it: it.from_channel) - results = sorted(results, key=lambda it: it.from_channel) # send_to_temp(to_temp) config.set_setting('tmdb_active', True) if item.mode == 'all': + if config.get_setting('result_mode', 'search') != 0: + res_count = len(results) + results = sorted(results, key=lambda it: it.title) results_statistic = config.get_localized_string(59972) % (item.title, res_count, time.time() - start) results.insert(0, Item(title = typo(results_statistic,'color kod bold'))) # logger.debug(results_statistic) - return valid + results @@ -284,7 +292,7 @@ def get_channel_results(ch, item, session): ch_params = channeltools.get_channel_parameters(ch) - exec "from channels import " + ch_params["channel"] + " as module" + exec("from channels import " + ch_params["channel"] + " as module") mainlist = 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)] @@ -735,5 +743,5 @@ def get_saved_searches(): saved_searches_list = [] else: saved_searches_list = list(current_saved_searches_list) - + return saved_searches_list \ No newline at end of file