aggiunta la possibilita di aprire link nel browser (o in alternativa ottenere un link corto)

This commit is contained in:
mac12m99
2019-11-23 19:47:42 +01:00
committed by marco
parent d33fdfd4ba
commit 2bda982a21
4 changed files with 27 additions and 2 deletions

View File

@@ -136,6 +136,13 @@ def run(item=None):
elif item.action == "itemInfo":
import base64
platformtools.dialog_textviewer('Item info', item.parent)
elif item.action == "open_browser":
try:
import webbrowser
webbrowser.open(item.url)
except:
short = urllib2.urlopen('https://u.nu/api.php?action=shorturl&format=simple&url=' + item.url).read()
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % short)
# Action in certain channel specified in "action" and "channel" parameters
else:
# Entry point for a channel is the "mainlist" action, so here we check parental control

View File

@@ -538,7 +538,9 @@ def set_context_commands(item, parent_item):
and parent_item.action != "mainlist":
context_commands.append((config.get_localized_string(60349), "XBMC.Container.Refresh (%s?%s)" %
(sys.argv[0], Item(channel=item.channel, action="mainlist").tourl())))
context_commands.insert(2, (config.get_localized_string(70739),
"XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(action="open_browser",
url=item.url).tourl())))
# Añadir a Favoritos
if num_version_xbmc < 17.0 and \
((item.channel not in ["favorites", "videolibrary", "help", ""]

View File

@@ -5671,4 +5671,12 @@ msgstr ""
msgctxt "#70738"
msgid "Ready channels %d/%d"
msgstr ""
msgctxt "#70739"
msgid "Open link in browser"
msgstr ""
msgctxt "#70740"
msgid "Your system does not have a web browser, so here's the short link you can open in another device:\n%s"
msgstr ""

View File

@@ -5675,4 +5675,12 @@ msgstr "[B]MENU LATERALE[/B]"
msgctxt "#70738"
msgid "Ready channels %d/%d"
msgstr "Canali pronti %d/%d"
msgstr "Canali pronti %d/%d"
msgctxt "#70739"
msgid "Open link in browser"
msgstr "Apri link nel browser"
msgctxt "#70740"
msgid "Your system does not have a web browser, so here's the short link you can open in another device:\n%s"
msgstr "Il tuo sistema non ha un browser, quindi ecco un link corto che puoi aprire in un altro dispositivo\n%s"