From 338409ca3b75dd58d9cbabf59e17fd331b70a489 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 27 Oct 2017 21:37:34 -0300 Subject: [PATCH] Agregada la opcion buscar en otros canales --- plugin.video.alfa/channels/search.py | 31 +++++++++++++++++-- .../platformcode/platformtools.py | 15 +++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/plugin.video.alfa/channels/search.py b/plugin.video.alfa/channels/search.py index 73a0190a..213eacf3 100644 --- a/plugin.video.alfa/channels/search.py +++ b/plugin.video.alfa/channels/search.py @@ -114,7 +114,7 @@ def setting_channel(item): custom_button_label = "Todos" return platformtools.show_channel_settings(list_controls=list_controls, - caption="Canales incluidos en la búsqueda global", + caption="Canales incluidos en la búsqueda", callback="save_settings", item=item, custom_button={'visible': True, 'function': "cb_custom_button", @@ -277,6 +277,13 @@ def channel_search(search_results, channel_parameters, tecleado): def do_search(item, categories=None): logger.info("blaa categorias %s" % categories) + if item.contextual==True: + categories = ["Películas"] + setting_item = Item(channel=item.channel, title="Elegir canales incluidos en la búsqueda", folder=False, + thumbnail=get_thumb("search.png")) + setting_channel(setting_item) + + if categories is None: categories = [] @@ -417,6 +424,8 @@ def do_search(item, categories=None): title = channel # resultados agrupados por canales + if item.contextual == True: + result_mode = 1 if result_mode == 0: if len(search_results[channel]) > 1: title += " [%s]" % element["item"].title.strip() @@ -432,7 +441,7 @@ def do_search(item, categories=None): else: title = " [ Resultados del canal %s ] " % channel itemlist.append(Item(title=title, channel="search", action="", - folder=False, text_bold=True)) + folder=False, text_bold=True, from_channel=channel)) for i in element["itemlist"]: if i.action: title = " " + i.title @@ -445,6 +454,24 @@ def do_search(item, categories=None): progreso.close() + #Para opcion Buscar en otros canales + if item.contextual == True: + return exact_results(itemlist, tecleado) + else: + return itemlist + + +def exact_results(results, wanted): + logger.info() + itemlist =[] + + for item in results: + if item.action=='': + channel=item.from_channel + if item.action != '' and item.contentTitle==wanted: + item.title = '%s [%s]' % (item.title, channel) + itemlist.append(item) + return itemlist diff --git a/plugin.video.alfa/platformcode/platformtools.py b/plugin.video.alfa/platformcode/platformtools.py index 74aec795..de27386d 100644 --- a/plugin.video.alfa/platformcode/platformtools.py +++ b/plugin.video.alfa/platformcode/platformtools.py @@ -394,6 +394,21 @@ def set_context_commands(item, parent_item): from_channel=item.channel, from_action=item.action).tourl()))) + #Buscar en otros canales + if item.contentType in ['movie','tvshow']and item.channel != 'search': + # Buscar en otros canales + if item.contentSerieName!='': + item.extra=item.contentSerieName + else: + item.extra = item.contentTitle + context_commands.append(("[COLOR yellow]Buscar en otros canales[/COLOR]", + "XBMC.Container.Update (%s?%s)" % (sys.argv[0], + item.clone(channel='search', + action="do_search", + from_channel=item.channel, + contextual=True).tourl()))) + + if item.channel != "videolibrary": # Añadir Serie a la videoteca if item.action in ["episodios", "get_episodios"] and item.contentSerieName: