platformtools dialogs kodi 19
This commit is contained in:
@@ -271,7 +271,7 @@ def downloadfile(url, nombrefichero, headers=None, silent=False, continuar=False
|
|||||||
|
|
||||||
# Create the progress dialog
|
# Create the progress dialog
|
||||||
if not silent:
|
if not silent:
|
||||||
progreso = platformtools.dialog_progress(header, "Downloading...", url, nombrefichero)
|
progreso = platformtools.dialog_progress(header, "Downloading..." + '\n' + url + '\n' + nombrefichero)
|
||||||
|
|
||||||
# If the platform does not return a valid dialog box, it assumes silent mode
|
# If the platform does not return a valid dialog box, it assumes silent mode
|
||||||
if progreso is None:
|
if progreso is None:
|
||||||
@@ -520,7 +520,7 @@ def downloadfileGzipped(url, pathfichero):
|
|||||||
|
|
||||||
# Create the progress dialog
|
# Create the progress dialog
|
||||||
from platformcode import platformtools
|
from platformcode import platformtools
|
||||||
progreso = platformtools.dialog_progress("addon", config.get_localized_string(60200), url.split("|")[0], nombrefichero)
|
progreso = platformtools.dialog_progress("addon", config.get_localized_string(60200) + '\n' + url.split("|")[0] + '\n' + nombrefichero)
|
||||||
|
|
||||||
# Socket timeout at 60 seconds
|
# Socket timeout at 60 seconds
|
||||||
socket.setdefaulttimeout(10)
|
socket.setdefaulttimeout(10)
|
||||||
|
|||||||
+2
-3
@@ -71,9 +71,8 @@ def token_trakt(item):
|
|||||||
else:
|
else:
|
||||||
import time
|
import time
|
||||||
dialog_auth = platformtools.dialog_progress(config.get_localized_string(60251),
|
dialog_auth = platformtools.dialog_progress(config.get_localized_string(60251),
|
||||||
config.get_localized_string(60252) % item.verify_url,
|
config.get_localized_string(60252) % item.verify_url + '\n' +
|
||||||
config.get_localized_string(60253)
|
config.get_localized_string(60253) % item.user_code + '\n' +
|
||||||
% item.user_code,
|
|
||||||
config.get_localized_string(60254))
|
config.get_localized_string(60254))
|
||||||
|
|
||||||
# Generalmente cada 5 segundos se intenta comprobar si el usuario ha introducido el código
|
# Generalmente cada 5 segundos se intenta comprobar si el usuario ha introducido el código
|
||||||
|
|||||||
+1
-2
@@ -37,8 +37,7 @@ def readLastMessage(mail):
|
|||||||
|
|
||||||
|
|
||||||
def waitForMail(mail, timeout=50):
|
def waitForMail(mail, timeout=50):
|
||||||
dialog = platformtools.dialog_progress(config.get_localized_string(20000),
|
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'verifica tramite mail richiesta dal sito, sono in attesa di nuove mail sulla casella ' + mail)
|
||||||
'verifica tramite mail richiesta dal sito, sono in attesa di nuove mail sulla casella ' + mail)
|
|
||||||
secs = 0
|
secs = 0
|
||||||
while secs < timeout:
|
while secs < timeout:
|
||||||
msg = readLastMessage(mail)
|
msg = readLastMessage(mail)
|
||||||
|
|||||||
@@ -30,17 +30,10 @@ class XBMCPlayer(xbmc.Player):
|
|||||||
|
|
||||||
xbmc_player = XBMCPlayer()
|
xbmc_player = XBMCPlayer()
|
||||||
|
|
||||||
def makeMessage(line1, line2, line3):
|
|
||||||
message = line1
|
|
||||||
if line2:
|
|
||||||
message += '\n' + line2
|
|
||||||
if line3:
|
|
||||||
message += '\n' + line3
|
|
||||||
return message
|
|
||||||
|
|
||||||
def dialog_ok(heading, line1, line2="", line3=""):
|
def dialog_ok(heading, message):
|
||||||
dialog = xbmcgui.Dialog()
|
dialog = xbmcgui.Dialog()
|
||||||
return dialog.ok(heading, makeMessage(line1, line2, line3))
|
return dialog.ok(heading, message)
|
||||||
|
|
||||||
|
|
||||||
def dialog_notification(heading, message, icon=3, time=5000, sound=True):
|
def dialog_notification(heading, message, icon=3, time=5000, sound=True):
|
||||||
@@ -52,19 +45,19 @@ def dialog_notification(heading, message, icon=3, time=5000, sound=True):
|
|||||||
dialog_ok(heading, message)
|
dialog_ok(heading, message)
|
||||||
|
|
||||||
|
|
||||||
def dialog_yesno(heading, line1, line2="", line3="", nolabel=config.get_localized_string(70170), yeslabel=config.get_localized_string(30022), autoclose=0, customlabel=None):
|
def dialog_yesno(heading, message, nolabel=config.get_localized_string(70170), yeslabel=config.get_localized_string(30022), autoclose=0, customlabel=None):
|
||||||
# customlabel only on kodi 19
|
# customlabel only on kodi 19
|
||||||
dialog = xbmcgui.Dialog()
|
dialog = xbmcgui.Dialog()
|
||||||
if config.get_platform() == 'kodi-matrix':
|
if config.get_platform() == 'kodi-matrix':
|
||||||
if autoclose:
|
if autoclose:
|
||||||
return dialog.yesno(heading, makeMessage(line1, line2, line3), nolabel=nolabel, yeslabel=yeslabel, customlabel=customlabel, autoclose=autoclose)
|
return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel, customlabel=customlabel, autoclose=autoclose)
|
||||||
else:
|
else:
|
||||||
return dialog.yesno(heading, makeMessage(line1, line2, line3), nolabel=nolabel, yeslabel=yeslabel, customlabel=customlabel)
|
return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel, customlabel=customlabel)
|
||||||
else:
|
else:
|
||||||
if autoclose:
|
if autoclose:
|
||||||
return dialog.yesno(heading, makeMessage(line1, line2, line3), nolabel=nolabel, yeslabel=yeslabel, autoclose=autoclose)
|
return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel, autoclose=autoclose)
|
||||||
else:
|
else:
|
||||||
return dialog.yesno(heading, makeMessage(line1, line2, line3), nolabel=nolabel, yeslabel=yeslabel)
|
return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel)
|
||||||
|
|
||||||
|
|
||||||
def dialog_select(heading, _list, preselect=0, useDetails=False):
|
def dialog_select(heading, _list, preselect=0, useDetails=False):
|
||||||
@@ -75,9 +68,9 @@ def dialog_multiselect(heading, _list, autoclose=0, preselect=[], useDetails=Fal
|
|||||||
return xbmcgui.Dialog().multiselect(heading, _list, autoclose=autoclose, preselect=preselect, useDetails=useDetails)
|
return xbmcgui.Dialog().multiselect(heading, _list, autoclose=autoclose, preselect=preselect, useDetails=useDetails)
|
||||||
|
|
||||||
|
|
||||||
def dialog_progress(heading, line1, line2=" ", line3=" "):
|
def dialog_progress(heading, message):
|
||||||
dialog = xbmcgui.DialogProgress()
|
dialog = xbmcgui.DialogProgress()
|
||||||
dialog.create(heading, makeMessage(line1, line2, line3))
|
dialog.create(heading, message)
|
||||||
return dialog
|
return dialog
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -112,8 +112,8 @@ def authentication():
|
|||||||
intervalo = data["interval"]
|
intervalo = data["interval"]
|
||||||
|
|
||||||
dialog_auth = platformtools.dialog_progress(config.get_localized_string(70414),
|
dialog_auth = platformtools.dialog_progress(config.get_localized_string(70414),
|
||||||
config.get_localized_string(60252) % verify_url,
|
config.get_localized_string(60252) % verify_url + '\n' +
|
||||||
config.get_localized_string(70413) % user_code,
|
config.get_localized_string(70413) % user_code + '\n' +
|
||||||
config.get_localized_string(60254))
|
config.get_localized_string(60254))
|
||||||
|
|
||||||
# Generalmente cada 5 segundos se intenta comprobar si el usuario ha introducido el código
|
# Generalmente cada 5 segundos se intenta comprobar si el usuario ha introducido el código
|
||||||
|
|||||||
+1
-2
@@ -48,8 +48,7 @@ def update(path, p_dialog, i, t, serie, overwrite):
|
|||||||
if channel_enabled:
|
if channel_enabled:
|
||||||
|
|
||||||
heading = config.get_localized_string(20000)
|
heading = config.get_localized_string(20000)
|
||||||
p_dialog.update(int(math.ceil((i + 1) * t)), heading, config.get_localized_string(60389) % (serie.contentSerieName,
|
p_dialog.update(int(math.ceil((i + 1) * t)), heading, config.get_localized_string(60389) % (serie.contentSerieName, serie.channel.capitalize()))
|
||||||
serie.channel.capitalize()))
|
|
||||||
try:
|
try:
|
||||||
pathchannels = filetools.join(config.get_runtime_path(), "channels", serie.channel + '.py')
|
pathchannels = filetools.join(config.get_runtime_path(), "channels", serie.channel + '.py')
|
||||||
logger.log("loading channel: " + pathchannels + " " +
|
logger.log("loading channel: " + pathchannels + " " +
|
||||||
|
|||||||
+2
-2
@@ -201,7 +201,7 @@ def channel_search(item):
|
|||||||
searching_titles += channel_titles
|
searching_titles += channel_titles
|
||||||
cnt = 0
|
cnt = 0
|
||||||
|
|
||||||
progress = platformtools.dialog_progress(config.get_localized_string(30993) % item.title, config.get_localized_string(70744) % len(channel_list), ', '.join(searching_titles))
|
progress = platformtools.dialog_progress(config.get_localized_string(30993) % item.title, config.get_localized_string(70744) % len(channel_list) + '\n' + ', '.join(searching_titles))
|
||||||
config.set_setting('tmdb_active', False)
|
config.set_setting('tmdb_active', False)
|
||||||
|
|
||||||
search_action_list = []
|
search_action_list = []
|
||||||
@@ -254,7 +254,7 @@ def channel_search(item):
|
|||||||
progress.close()
|
progress.close()
|
||||||
|
|
||||||
cnt = 0
|
cnt = 0
|
||||||
progress = platformtools.dialog_progress(config.get_localized_string(30993) % item.title, config.get_localized_string(60295), config.get_localized_string(60293))
|
progress = platformtools.dialog_progress(config.get_localized_string(30993) % item.title, config.get_localized_string(60295) + '\n' + config.get_localized_string(60293))
|
||||||
|
|
||||||
config.set_setting('tmdb_active', True)
|
config.set_setting('tmdb_active', True)
|
||||||
# res_count = 0
|
# res_count = 0
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ if 'KOD_TST_CH' not in os.environ:
|
|||||||
xbmc.get_add_on_info_from_calling_script = add_on_info
|
xbmc.get_add_on_info_from_calling_script = add_on_info
|
||||||
|
|
||||||
|
|
||||||
import HtmlTestRunner
|
# import HtmlTestRunner
|
||||||
import parameterized
|
import parameterized
|
||||||
|
|
||||||
from platformcode import config, logger
|
from platformcode import config, logger
|
||||||
@@ -145,7 +145,7 @@ for chItem in channel_list:
|
|||||||
serversFound = {}
|
serversFound = {}
|
||||||
|
|
||||||
for it in mainlist:
|
for it in mainlist:
|
||||||
print 'preparing ' + ch + ' -> ' + it.title
|
print('preparing ' + ch + ' -> ' + it.title)
|
||||||
|
|
||||||
if it.action == 'channel_config':
|
if it.action == 'channel_config':
|
||||||
hasChannelConfig = True
|
hasChannelConfig = True
|
||||||
@@ -177,7 +177,7 @@ for chItem in channel_list:
|
|||||||
|
|
||||||
from specials import news
|
from specials import news
|
||||||
dictNewsChannels, any_active = news.get_channels_list()
|
dictNewsChannels, any_active = news.get_channels_list()
|
||||||
print channels
|
print(channels)
|
||||||
# only 1 server item for single server
|
# only 1 server item for single server
|
||||||
serverNames = []
|
serverNames = []
|
||||||
serversFinal = []
|
serversFinal = []
|
||||||
@@ -207,7 +207,7 @@ class GenericChannelTest(unittest.TestCase):
|
|||||||
title, itemlist in ch['menuItemlist'].items()])
|
title, itemlist in ch['menuItemlist'].items()])
|
||||||
class GenericChannelMenuItemTest(unittest.TestCase):
|
class GenericChannelMenuItemTest(unittest.TestCase):
|
||||||
def test_menu(self):
|
def test_menu(self):
|
||||||
print 'testing ' + self.ch + ' --> ' + self.title
|
print('testing ' + self.ch + ' --> ' + self.title)
|
||||||
self.assertTrue(self.module.host, 'channel ' + self.ch + ' has not a valid hostname')
|
self.assertTrue(self.module.host, 'channel ' + self.ch + ' has not a valid hostname')
|
||||||
self.assertTrue(self.itemlist, 'channel ' + self.ch + ' -> ' + self.title + ' is empty')
|
self.assertTrue(self.itemlist, 'channel ' + self.ch + ' -> ' + self.title + ' is empty')
|
||||||
self.assertTrue(self.serversFound,
|
self.assertTrue(self.serversFound,
|
||||||
@@ -245,7 +245,7 @@ class GenericChannelMenuItemTest(unittest.TestCase):
|
|||||||
self.assertTrue(nextPageItemlist,
|
self.assertTrue(nextPageItemlist,
|
||||||
'channel ' + self.ch + ' -> ' + self.title + ' has nextpage not working')
|
'channel ' + self.ch + ' -> ' + self.title + ' has nextpage not working')
|
||||||
|
|
||||||
print '<br>test passed'
|
print('<br>test passed')
|
||||||
|
|
||||||
|
|
||||||
@parameterized.parameterized_class(serversFinal)
|
@parameterized.parameterized_class(serversFinal)
|
||||||
@@ -253,7 +253,7 @@ class GenericServerTest(unittest.TestCase):
|
|||||||
def test_get_video_url(self):
|
def test_get_video_url(self):
|
||||||
module = __import__('servers.%s' % self.name, fromlist=["servers.%s" % self.name])
|
module = __import__('servers.%s' % self.name, fromlist=["servers.%s" % self.name])
|
||||||
page_url = self.server.url
|
page_url = self.server.url
|
||||||
print 'testing ' + page_url
|
print('testing ' + page_url)
|
||||||
self.assert_(hasattr(module, 'test_video_exists'), self.name + ' has no test_video_exists')
|
self.assert_(hasattr(module, 'test_video_exists'), self.name + ' has no test_video_exists')
|
||||||
try:
|
try:
|
||||||
if module.test_video_exists(page_url)[0]:
|
if module.test_video_exists(page_url)[0]:
|
||||||
@@ -261,7 +261,7 @@ class GenericServerTest(unittest.TestCase):
|
|||||||
server_parameters = servertools.get_server_parameters(self.name)
|
server_parameters = servertools.get_server_parameters(self.name)
|
||||||
self.assertTrue(urls or server_parameters.get("premium"),
|
self.assertTrue(urls or server_parameters.get("premium"),
|
||||||
self.name + ' scraper did not return direct urls for ' + page_url)
|
self.name + ' scraper did not return direct urls for ' + page_url)
|
||||||
print urls
|
print(urls)
|
||||||
for u in urls:
|
for u in urls:
|
||||||
spl = u[1].split('|')
|
spl = u[1].split('|')
|
||||||
if len(spl) == 2:
|
if len(spl) == 2:
|
||||||
@@ -274,7 +274,7 @@ class GenericServerTest(unittest.TestCase):
|
|||||||
h, v = name.split('=')
|
h, v = name.split('=')
|
||||||
h = str(h)
|
h = str(h)
|
||||||
headers[h] = str(v)
|
headers[h] = str(v)
|
||||||
print headers
|
print(headers)
|
||||||
if 'magnet:?' in directUrl: # check of magnet links not supported
|
if 'magnet:?' in directUrl: # check of magnet links not supported
|
||||||
continue
|
continue
|
||||||
page = downloadpage(directUrl, headers=headers, only_headers=True, use_requests=True)
|
page = downloadpage(directUrl, headers=headers, only_headers=True, use_requests=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user