From 0ec3a3766052a8d13cff4ae3d78841abbc56141d Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Fri, 15 May 2020 17:01:21 +0200 Subject: [PATCH 1/2] Fix Elementum download per Android TV --- specials/elementum_download.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/specials/elementum_download.py b/specials/elementum_download.py index 1e28094b..56717628 100644 --- a/specials/elementum_download.py +++ b/specials/elementum_download.py @@ -37,9 +37,20 @@ def download(item=None): def extract(): import zipfile + from platformcode.updater import fixZipGetHash, fOpen support.log('Estraggo Elementum in:', elementum_path) - with zipfile.ZipFile(filename, 'r') as zip_ref: - zip_ref.extractall(xbmc.translatePath(addon_path)) + try: + hash = fixZipGetHash(filename) + support.log(hash) + + with zipfile.ZipFile(fOpen(filename, 'rb')) as zip_ref: + zip_ref.extractall(xbmc.translatePath(addon_path)) + + except Exception as e: + support.log('Non sono riuscito ad estrarre il file zip') + support.logger.error(e) + import traceback + support.logger.error(traceback.print_exc()) def setting(): From cfc5171a84179f800f3d2031d3607ffe51197236 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Fri, 15 May 2020 19:03:10 +0200 Subject: [PATCH 2/2] Migliorie a Menu Rapido --- platformcode/keymaptools.py | 25 +- .../skins/Default/720p/DarkShortCutMenu.xml | 251 +++++++----------- resources/skins/Default/720p/ShortCutMenu.xml | 251 +++++++----------- 3 files changed, 207 insertions(+), 320 deletions(-) diff --git a/platformcode/keymaptools.py b/platformcode/keymaptools.py index bc3be98e..1970cc3b 100644 --- a/platformcode/keymaptools.py +++ b/platformcode/keymaptools.py @@ -22,9 +22,11 @@ class KeyListener(xbmcgui.WindowXMLDialog): filenname = "DialogKaiToast.xml" return super(KeyListener, cls).__new__(cls, filenname, "") + def __init__(self): self.key = None + def onInit(self): try: self.getControl(401).addLabel(config.get_localized_string(70698)) @@ -33,6 +35,7 @@ class KeyListener(xbmcgui.WindowXMLDialog): self.getControl(401).setLabel(config.get_localized_string(70698)) self.getControl(402).setLabel(config.get_localized_string(70699) % self.TIMEOUT) + def onAction(self, action): code = action.getButtonCode() if code == 0: @@ -41,6 +44,7 @@ class KeyListener(xbmcgui.WindowXMLDialog): self.key = str(code) self.close() + @staticmethod def record_key(): dialog = KeyListener() @@ -70,6 +74,7 @@ def set_key(): return + def delete_key(): from core import filetools from platformcode import platformtools @@ -82,13 +87,13 @@ def delete_key(): config.set_setting("shortcut_key", '') - class Main(xbmcgui.WindowXMLDialog): def __init__(self, *args, **kwargs): self.items = [] + def onInit(self): - #### Compatibilidad con Kodi 18 #### + #### Compatibility with Kodi 18 #### if config.get_platform(True)['num_version'] < 18: self.setCoordinateResolution(2) @@ -98,7 +103,7 @@ class Main(xbmcgui.WindowXMLDialog): if not submenu and menuentry.channel in ['news', 'channelselector', 'search', 'videolibrary']: item.setProperty('sub', 'Controls/spinUp-Focus.png') if menuentry.title != 'Redirect': - for key, value in json.loads(menuentry.tojson()).items(): + for key , value in json.loads(menuentry.tojson()).items(): item.setProperty(key, str(value)) item.setProperty('run', menuentry.tojson()) self.items.append(item) @@ -106,6 +111,7 @@ class Main(xbmcgui.WindowXMLDialog): self.getControl(32500).addItems(self.items) self.setFocusId(32500) + def onClick(self, control_id): if control_id == 32500: action = self.getControl(32500).getSelectedItem().getProperty('run') @@ -118,7 +124,7 @@ class Main(xbmcgui.WindowXMLDialog): # exit if action.getId() in [xbmcgui.ACTION_PREVIOUS_MENU, xbmcgui.ACTION_NAV_BACK]: self.close() - if submenu: open_shortcut_menu() + if submenu: open_shortcut_menu(self=True) if action.getId() == xbmcgui.ACTION_CONTEXT_MENU: config.open_settings() @@ -130,23 +136,22 @@ class Main(xbmcgui.WindowXMLDialog): self.setFocusId(32500) elif submenu: self.close() - open_shortcut_menu() + open_shortcut_menu(self=True) elif self.getControl(32500).getSelectedItem().getProperty('channel') in ['news', 'channelselector', 'search', 'videolibrary']: channel_name = self.getControl(32500).getSelectedItem().getProperty('channel') if channel_name == 'channelselector': import channelselector self.close() - open_shortcut_menu(channelselector.getchanneltypes(), channel_name) + open_shortcut_menu(channelselector.getchanneltypes(), channel_name, self=True) else: from core.item import Item channel = __import__('specials.%s' % channel_name, fromlist=["specials.%s" % channel_name]) self.close() - open_shortcut_menu(channel.mainlist(Item()), channel_name) + open_shortcut_menu(channel.mainlist(Item()), channel_name, self=True) - -def open_shortcut_menu(newmenu='', channel=''): - xbmc.executebuiltin('Dialog.Close(all,true)') +def open_shortcut_menu(newmenu='', channel='', self=False): + if not self: xbmc.executebuiltin('Dialog.Close(all,true)') global menu global submenu global prevchannel diff --git a/resources/skins/Default/720p/DarkShortCutMenu.xml b/resources/skins/Default/720p/DarkShortCutMenu.xml index 9ba71b24..cee155c4 100644 --- a/resources/skins/Default/720p/DarkShortCutMenu.xml +++ b/resources/skins/Default/720p/DarkShortCutMenu.xml @@ -2,172 +2,113 @@ 0.52 - 200 - 250 + 0 + 0 - 32500 - - - - - - - - -200 - -250 - 1280 - 720 - Shortcut/white.png - Shortcut/white.png + + + 0 + 0 + 100% + 100% + Shortcut/white.png + Shortcut/white.png + WindowOpen + WindowClose Action(close) + + 100 + 250 - - + + - - + + - + + + Control.HasFocus(61) + Unfocus + Focus 0 - 0 - 880 + 219 + 1100 + 10 + Shortcut/white.png + Shortcut/white.png + Shortcut/white.png + false + horizontal + 32500 + + + + 1100 + 218 + Shortcut/white.png + + + -130 + -1 + 1100 220 - Shortcut/white.png + 32501 + 61 + horizontal + 200 + 61 + Conditional + Conditional + + + 220 + 220 + $INFO[ListItem.Property(thumbnail)] + keep + center + + + + + 1 + 220 + 218 + Shortcut/white.png + + + 0 + 160 + 220 + 74 + font12 + FFFFFFFF + + center + center + + + 100 + 5 + 20 + 20 + $INFO[ListItem.Property(sub)] + keep + center + + + 220 + 220 + $INFO[ListItem.Property(thumbnail)] + keep + center + + - - - -21 - 0 - 1011 - 220 - Shortcut/dialogbutton-nofo.png - - - -130 - 0 - 880 - 220 - 32501 - 61 - horizontal - 200 - 61 - Conditional - Conditional - - - 0 - 0 - 220 - 220 - Shortcut/button-nofo.png - - - 30 - 149 - 306 - 75 - Shortcut/black.png - - - 220 - 220 - $INFO[ListItem.Property(thumbnail)] - keep - center - - - 329 - 24 - 50 - 50 - keep - $INFO[ListItem.Overlay] - - - - - 0.10 - - 220 - 220 - Shortcut/button-nofo.png - Unfocus - Focus - - - 1 - 220 - 218 - Shortcut/button-fo.png - Unfocus - - - 5 - 24 - 50 - 50 - keep - $INFO[ListItem.Overlay] - - - 23 - 149 - 298 - 75 - Shortcut/black.png - - - 220 - 220 - $INFO[ListItem.Property(thumbnail)] - keep - center - - - 0 - 160 - 220 - 74 - font12 - FF232323 - - center - center - - - 100 - 5 - 20 - 20 - $INFO[ListItem.Property(sub)] - keep - center - - - - - - -120 - 220 - 880 - 10 - Shortcut/white.png - Shortcut/white.png - Shortcut/white.png - - - - - false - horizontal - 32500 - - Conditional - - - + diff --git a/resources/skins/Default/720p/ShortCutMenu.xml b/resources/skins/Default/720p/ShortCutMenu.xml index d36e2ab4..dfb2a0eb 100644 --- a/resources/skins/Default/720p/ShortCutMenu.xml +++ b/resources/skins/Default/720p/ShortCutMenu.xml @@ -2,172 +2,113 @@ 0.52 - 200 - 250 + 0 + 0 - 32500 - - - - - - - - -200 - -250 - 1280 - 720 - Shortcut/white.png - Shortcut/white.png + + + 0 + 0 + 100% + 100% + Shortcut/white.png + Shortcut/white.png + WindowOpen + WindowClose Action(close) + + 100 + 250 - - + + - - + + - + + + Control.HasFocus(61) + Unfocus + Focus 0 - 0 - 880 + 219 + 1100 + 10 + Shortcut/white.png + Shortcut/white.png + Shortcut/white.png + false + horizontal + 32500 + + + + 1100 + 218 + Shortcut/white.png + + + -130 + -1 + 1100 220 - Shortcut/white.png + 32501 + 61 + horizontal + 200 + 61 + Conditional + Conditional + + + 220 + 220 + $INFO[ListItem.Property(thumbnail)] + keep + center + + + + + 1 + 220 + 218 + Shortcut/white.png + + + 0 + 160 + 220 + 74 + font12 + FFFFFFFF + + center + center + + + 100 + 5 + 20 + 20 + $INFO[ListItem.Property(sub)] + keep + center + + + 220 + 220 + $INFO[ListItem.Property(thumbnail)] + keep + center + + - - - -21 - 0 - 1011 - 220 - Shortcut/dialogbutton-nofo.png - - - -130 - 0 - 880 - 220 - 32501 - 61 - horizontal - 200 - 61 - Conditional - Conditional - - - 0 - 0 - 220 - 220 - Shortcut/button-nofo.png - - - 30 - 149 - 306 - 75 - Shortcut/black.png - - - 220 - 220 - $INFO[ListItem.Property(thumbnail)] - keep - center - - - 329 - 24 - 50 - 50 - keep - $INFO[ListItem.Overlay] - - - - - 0.10 - - 220 - 220 - Shortcut/button-nofo.png - Unfocus - Focus - - - 1 - 220 - 218 - Shortcut/button-fo.png - Unfocus - - - 5 - 24 - 50 - 50 - keep - $INFO[ListItem.Overlay] - - - 23 - 149 - 298 - 75 - Shortcut/black.png - - - 220 - 220 - $INFO[ListItem.Property(thumbnail)] - keep - center - - - 0 - 160 - 220 - 74 - font12 - FFFFFFFF - - center - center - - - 100 - 5 - 20 - 20 - $INFO[ListItem.Property(sub)] - keep - center - - - - - - -120 - 220 - 880 - 10 - Shortcut/white.png - Shortcut/white.png - Shortcut/white.png - - - - - false - horizontal - 32500 - - Conditional - - - +