From 25a97a3f115314e32b2db72d2fd912068b8103e4 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Tue, 13 Jul 2021 21:17:01 +0200 Subject: [PATCH] "Vai a pagina" nel menu contestuale --- core/tmdb.py | 2 ++ platformcode/launcher.py | 12 +++++++++++- platformcode/platformtools.py | 2 ++ .../language/resource.language.en_gb/strings.po | 4 ++-- .../language/resource.language.it_it/strings.po | 8 ++++---- specials/search.py | 12 +++++++----- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/core/tmdb.py b/core/tmdb.py index 6f3222c9..ed320df1 100644 --- a/core/tmdb.py +++ b/core/tmdb.py @@ -622,6 +622,8 @@ def discovery(item, dict_=False, cast=False): from core.item import Item if dict_: + if item.page: + item.discovery['page'] = item.page listado = Tmdb(discover = dict_, cast=cast) elif item.search_type == 'discover': diff --git a/platformcode/launcher.py b/platformcode/launcher.py index 693bdd67..d11216fc 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -2,7 +2,6 @@ # ------------------------------------------------------------ # XBMC Launcher (xbmc / kodi) # ------------------------------------------------------------ - import sys, os PY3 = False if sys.version_info[0] >= 3:PY3 = True; unicode = str; unichr = chr; long = int @@ -151,6 +150,17 @@ def run(item=None): import urllib short = urllib.urlopen('https://u.nu/api.php?action=shorturl&format=simple&url=' + item.url).read().decode('utf-8') platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % short) + elif item.action == "gotopage": + page = platformtools.dialog_numeric(0, config.get_localized_string(70513)) + if page: + import xbmc + item.action = item.real_action + if item.page: + item.page = page + else: + import re + item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>' + page + '\g<2>', item.url) + xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl())) else: # Checks if channel exists if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + ".py")): diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index a3eb98c9..81f7c69c 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -648,6 +648,8 @@ def set_context_commands(item, item_url, parent_item, **kwargs): if (item.contentTitle and item.contentType in ['movie', 'tvshow']) or "buscar_trailer" in context: context_commands.append((config.get_localized_string(60359), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, urllib.urlencode({ 'channel': "trailertools", 'action': "buscartrailer", 'search_title': item.contentTitle if item.contentTitle else item.fulltitle, 'contextual': True})))) + if item.nextPage: + context_commands.append((config.get_localized_string(70511), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=gotopage&real_action='+item.action))) if config.dev_mode(): context_commands.insert(0, ("item info", "Container.Update (%s?%s)" % (sys.argv[0], Item(action="itemInfo", parent=item.tojson()).tourl()))) return context_commands diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 0c59e78d..da5a632b 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -4845,7 +4845,7 @@ msgid "Manual Search" msgstr "" msgctxt "#70511" -msgid "" +msgid "Goto page" msgstr "" msgctxt "#70512" @@ -4853,7 +4853,7 @@ msgid "Searching in Mymovies" msgstr "" msgctxt "#70513" -msgid "" +msgid "Insert page number" msgstr "" msgctxt "#70514" diff --git a/resources/language/resource.language.it_it/strings.po b/resources/language/resource.language.it_it/strings.po index 0163f562..8c0632da 100644 --- a/resources/language/resource.language.it_it/strings.po +++ b/resources/language/resource.language.it_it/strings.po @@ -4844,16 +4844,16 @@ msgid "Manual Search" msgstr "Ricerca Manuale" msgctxt "#70511" -msgid "" -msgstr "" +msgid "Goto page" +msgstr "Vai a pagina" msgctxt "#70512" msgid "Searching in Mymovies" msgstr "Ricerca in Mymovies" msgctxt "#70513" -msgid "" -msgstr "" +msgid "Insert page number" +msgstr "Inserisci numero di pagina" msgctxt "#70514" msgid "" diff --git a/specials/search.py b/specials/search.py index e420d47d..bbf94837 100644 --- a/specials/search.py +++ b/specials/search.py @@ -722,12 +722,14 @@ def discover_list(item): elif len(result) > 19 and item.discovery: item.discovery['page'] = str(int(item.discovery['page']) + 1) - itemlist.append(Item(channel=item.channel, action='discover_list', title=typo(config.get_localized_string(30992), 'color kod bold'), - list_type=item.list_type, discovery=item.discovery, thumbnail=thumb())) + itemlist.append(Item(channel=item.channel, action='discover_list', nextPage=True, + title=typo(config.get_localized_string(30992), 'color kod bold'), + list_type=item.list_type, discovery=item.discovery, thumbnail=thumb(), page=item.discovery['page'])) elif len(result) > 19: next_page = str(int(item.page) + 1) - itemlist.append(Item(channel=item.channel, action='discover_list', title=typo(config.get_localized_string(30992), 'color kod bold'), + itemlist.append(Item(channel=item.channel, action='discover_list', nextPage=True, + title=typo(config.get_localized_string(30992), 'color kod bold'), list_type=item.list_type, search_type=item.search_type, mode=item.mode, page=next_page, thumbnail=thumb())) return itemlist @@ -789,8 +791,8 @@ def get_from_temp(item): results = [Item().fromurl(elem) for elem in item.itemlist[prevp:nextp]] if nextp < nTotal: - results.append(Item(channel='search', title=typo(config.get_localized_string(30992),'bold color kod'), - action='get_from_temp', itemlist=item.itemlist, page=item.page + 1)) + results.append(Item(channel='search', title=typo(config.get_localized_string(30992), 'bold color kod'), + action='get_from_temp', itemlist=item.itemlist, page=item.page + 1, nextPage=True)) tmdb.set_infoLabels_itemlist(results, True) for elem in results: