From 049281991b6dae2a5eb4fa58b17a8f0b887982e8 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Mon, 30 Nov 2020 18:59:22 +0100 Subject: [PATCH] Nuova Ricerca Globale aggiunto pulsante Menu e alcuni fix --- platformcode/globalsearch.py | 68 +++++++++++------- resources/skins/Default/720p/GlobalSearch.xml | 31 +++++--- resources/skins/Default/media/menu.png | Bin 0 -> 2940 bytes 3 files changed, 63 insertions(+), 36 deletions(-) create mode 100644 resources/skins/Default/media/menu.png diff --git a/platformcode/globalsearch.py b/platformcode/globalsearch.py index 44c5d968..45e68d0a 100644 --- a/platformcode/globalsearch.py +++ b/platformcode/globalsearch.py @@ -26,7 +26,7 @@ def set_workers(): def Search(item): xbmc.executebuiltin('Dialog.Close(all,true)') SearchWindow('GlobalSearch.xml', config.get_runtime_path()).start(item) - xbmc.sleep(600) + xbmc.sleep(700) # Actions LEFT = 1 @@ -52,8 +52,9 @@ RESULTS = 102 PROGRESS = 500 COUNT = 501 -CLOSE = 502 +MENU = 502 BACK = 503 +CLOSE = 504 # Servers EPISODESLIST = 200 @@ -375,25 +376,7 @@ class SearchWindow(xbmcgui.WindowXML): action = action.getId() focus = self.getFocusId() if action in [CONTEXT] and focus in [RESULTS]: - pos = self.RESULTS.getSelectedPosition() - name = self.CHANNELS.getSelectedItem().getLabel() - item = self.results[name][0][pos] - context = [config.get_localized_string(70739), config.get_localized_string(70557), config.get_localized_string(60359)] - context_commands = ["RunPlugin(%s?%s)" % (sys.argv[0], 'action=open_browser&url=' + item.url), - "RunPlugin(%s?%s&%s)" % (sys.argv[0], item.tourl(), 'channel=kodfavorites&action=addFavourite&from_channel=' + item.channel + '&from_action=' + item.action), - "RunPlugin(%s?%s)" % (sys.argv[0], 'channel=trailertools&action=buscartrailer&contextual=True&search_title=' + item.contentTitle if item.contentTitle else item.fulltitle)] - if item.contentType == 'movie': - context += [config.get_localized_string(60353), config.get_localized_string(60354)] - context_commands += ["RunPlugin(%s?%s&%s)" % (sys.argv[0], item.tourl(), 'action=add_pelicula_to_library&from_action=' + item.action), - "RunPlugin(%s?%s&%s)" % (sys.argv[0], item.tourl(), 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' +item.action)] - - else: - context += [config.get_localized_string(60352), config.get_localized_string(60355), config.get_localized_string(60357)] - context_commands += ["RunPlugin(%s?%s&%s)" % (sys.argv[0], item.tourl(), 'action=add_serie_to_library&from_action=' + item.action), - "RunPlugin(%s?%s&%s)" % (sys.argv[0], item.tourl(), 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action), - "RunPlugin(%s?%s&%s)" % (sys.argv[0], item.tourl(), 'channel=downloads&action=save_download&download=season&from_channel=' + item.channel +'&from_action=' + item.action)] - index = xbmcgui.Dialog().contextmenu(context) - if index > 0: xbmc.executebuiltin(context_commands[index]) + self.context() elif action in [SWIPEUP]: self.setFocusId(CHANNELS) @@ -410,9 +393,9 @@ class SearchWindow(xbmcgui.WindowXML): self.RESULTS.addItems(items) self.RESULTS.selectItem(subpos) - elif action in [DOWN] and focus in [BACK, CLOSE]: - if self.EPISODES.isVisible(): self.setFocusId(EPISODES) - if self.SERVERS.isVisible(): self.setFocusId(SERVERS) + elif action in [DOWN] and focus in [BACK, CLOSE, MENU]: + if self.SERVERS.isVisible(): self.setFocusId(SERVERLIST) + if self.EPISODES.isVisible(): self.setFocusId(EPISODESLIST) else: self.setFocusId(RESULTS) elif focus in [RESULTS] and self.item.mode == 'all': @@ -446,6 +429,9 @@ class SearchWindow(xbmcgui.WindowXML): elif control_id in [CLOSE]: self.Close() + elif control_id in [MENU]: + self.context() + elif search: pos = self.RESULTS.getSelectedPosition() if search == 'next': @@ -475,8 +461,14 @@ class SearchWindow(xbmcgui.WindowXML): self.pos = self.EPISODESLIST.getSelectedPosition() item = self.episodes[self.pos] # dbg() - self.channel = __import__('channels.%s' % item.channel, fromlist=["channels.%s" % item.channel]) - self.itemsResult = getattr(self.channel, item.action)(item) + try: + self.channel = __import__('channels.%s' % item.channel, fromlist=["channels.%s" % item.channel]) + self.itemsResult = getattr(self.channel, item.action)(item) + except: + import traceback + logger.error('error importing/getting search items of ' + item.channel) + logger.error(traceback.format_exc()) + self.itemsResult = [] if self.itemsResult and self.itemsResult[0].action in ['play']: @@ -554,6 +546,7 @@ class SearchWindow(xbmcgui.WindowXML): self.setFocusId(RESULTS) self.RESULTS.selectItem(self.pos) elif self.EPISODES.isVisible(): + self.episodes = [] self.Focus(SEARCH) self.setFocusId(RESULTS) self.RESULTS.selectItem(self.pos) @@ -569,4 +562,25 @@ class SearchWindow(xbmcgui.WindowXML): busy(True) while self.thread.is_alive(): xbmc.sleep(200) busy(False) - self.close() \ No newline at end of file + self.close() + + def context(self): + pos = self.RESULTS.getSelectedPosition() + name = self.CHANNELS.getSelectedItem().getLabel() + item = self.results[name][0][pos] + context = [config.get_localized_string(70739), config.get_localized_string(70557), config.get_localized_string(60359)] + context_commands = ["RunPlugin(%s?%s)" % (sys.argv[0], 'action=open_browser&url=' + item.url), + "RunPlugin(%s?%s&%s)" % (sys.argv[0], item.tourl(), 'channel=kodfavorites&action=addFavourite&from_channel=' + item.channel + '&from_action=' + item.action), + "RunPlugin(%s?%s)" % (sys.argv[0], 'channel=trailertools&action=buscartrailer&contextual=True&search_title=' + item.contentTitle if item.contentTitle else item.fulltitle)] + if item.contentType == 'movie': + context += [config.get_localized_string(60353), config.get_localized_string(60354)] + context_commands += ["RunPlugin(%s?%s&%s)" % (sys.argv[0], item.tourl(), 'action=add_pelicula_to_library&from_action=' + item.action), + "RunPlugin(%s?%s&%s)" % (sys.argv[0], item.tourl(), 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' +item.action)] + + else: + context += [config.get_localized_string(60352), config.get_localized_string(60355), config.get_localized_string(60357)] + context_commands += ["RunPlugin(%s?%s&%s)" % (sys.argv[0], item.tourl(), 'action=add_serie_to_library&from_action=' + item.action), + "RunPlugin(%s?%s&%s)" % (sys.argv[0], item.tourl(), 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action), + "RunPlugin(%s?%s&%s)" % (sys.argv[0], item.tourl(), 'channel=downloads&action=save_download&download=season&from_channel=' + item.channel +'&from_action=' + item.action)] + index = xbmcgui.Dialog().contextmenu(context) + if index > 0: xbmc.executebuiltin(context_commands[index]) \ No newline at end of file diff --git a/resources/skins/Default/720p/GlobalSearch.xml b/resources/skins/Default/720p/GlobalSearch.xml index 3003afc6..5d4a783b 100644 --- a/resources/skins/Default/720p/GlobalSearch.xml +++ b/resources/skins/Default/720p/GlobalSearch.xml @@ -99,7 +99,7 @@ 100% 570 101 - 503 + 502 horizontal 300 @@ -302,8 +302,8 @@ 520 700 570 - 503 - 503 + 502 + 502 300 @@ -376,8 +376,8 @@ 520 700 570 - 503 - 503 + 502 + 502 300 @@ -492,7 +492,7 @@ 00000000 right center - Conditional + Conditional Control.IsVisible(500) @@ -526,6 +526,19 @@ Control.IsVisible(5) + + Menu + 30 + 110 + 40 + 40 + 504 + 503 + menu.png + menu.png + Integer.IsGreater(Container(101).NumItems, 0) + + Back 30 @@ -533,19 +546,19 @@ 40 40 502 - 502 + 504 left.png left.png - + Close 30 30 40 40 503 - 503 + 502 close.png close.png diff --git a/resources/skins/Default/media/menu.png b/resources/skins/Default/media/menu.png new file mode 100644 index 0000000000000000000000000000000000000000..eac13daf2a90f017bf9e0a22e6a6bf6cc09fcec8 GIT binary patch literal 2940 zcmb_eX;@QN8V;h!B8!R(Ws8BS3uY$>F@drK5-_Y0f{GZD8xqMza)AV;D%Da^svv3s z1!s&PMG-*}WRbeCs0iW+QU#%C5h}~5P_Zm?lTg%((?65vxk=7>-*0=*cfMr5zps~} z{ulZ%7|f7H^$3JMNvcOz2YM%tw@YELdG&k-6J*ji5ZPiOip3E}04TXo0^tzPMJ{2n zqW};d0YvgeWW-R#H3Xc`AtOQvbPQeM4)FNYcqtGR@5^AvN3oqa2p4C4lAH)R5CR|z zE*A5QmI81Bih#l(ob}-(DThl8^zfWEhE`+* z4+JGd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