Nuovi messaggi di errore, fix autoplay (wstream aveva sempre la priorità) e modifiche varie
This commit is contained in:
@@ -341,13 +341,10 @@ def run(item=None):
|
||||
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + r'([^.]+)\.py"'
|
||||
Channel = scrapertools.find_single_match(traceback.format_exc(), patron)
|
||||
|
||||
platformtools.dialog_ok(
|
||||
config.get_localized_string(59985) + Channel,
|
||||
config.get_localized_string(60013) %(e))
|
||||
except:
|
||||
config.get_localized_string(59985) % e.channel,
|
||||
config.get_localized_string(60013) % e.url)
|
||||
except Exception as e:
|
||||
import traceback
|
||||
from core import scrapertools
|
||||
|
||||
@@ -356,26 +353,15 @@ def run(item=None):
|
||||
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + r'([^.]+)\.py"'
|
||||
Channel = scrapertools.find_single_match(traceback.format_exc(), patron)
|
||||
|
||||
try:
|
||||
import xbmc
|
||||
if config.get_platform(True)['num_version'] < 14:
|
||||
log_name = "xbmc.log"
|
||||
else:
|
||||
log_name = "kodi.log"
|
||||
log_message = config.get_localized_string(50004) + xbmc.translatePath("special://logpath") + log_name
|
||||
except:
|
||||
log_message = ""
|
||||
|
||||
if Channel:
|
||||
if Channel or e.__class__ == logger.ChannelScraperException:
|
||||
if item.url:
|
||||
if platformtools.dialog_yesno(config.get_localized_string(60087) % Channel, config.get_localized_string(60014) + '\n' + log_message, nolabel='ok', yeslabel=config.get_localized_string(70739)):
|
||||
if platformtools.dialog_yesno(config.get_localized_string(60087) % Channel, config.get_localized_string(60014), nolabel='ok', yeslabel=config.get_localized_string(70739)):
|
||||
run(Item(action="open_browser", url=item.url))
|
||||
else:
|
||||
platformtools.dialog_ok(config.get_localized_string(60087) % Channel, config.get_localized_string(60014) + '\n' + log_message)
|
||||
platformtools.dialog_ok(config.get_localized_string(60087) % Channel, config.get_localized_string(60014))
|
||||
else:
|
||||
platformtools.dialog_ok(
|
||||
config.get_localized_string(60038),
|
||||
config.get_localized_string(60015) + '\n' + log_message)
|
||||
if platformtools.dialog_yesno(config.get_localized_string(60038), config.get_localized_string(60015)):
|
||||
run(Item(channel="setting", action="report_menu"))
|
||||
|
||||
|
||||
def new_search(item, channel=None):
|
||||
|
||||
@@ -53,5 +53,11 @@ def log(*args, **kwargs):
|
||||
|
||||
|
||||
class WebErrorException(Exception):
|
||||
def __init__(self, *args, **kwargs):
|
||||
def __init__(self, url, channel, *args, **kwargs):
|
||||
self.url = url
|
||||
self.channel = channel
|
||||
Exception.__init__(self, *args, **kwargs)
|
||||
|
||||
|
||||
class ChannelScraperException(Exception):
|
||||
pass
|
||||
@@ -179,6 +179,50 @@ def dialog_register(heading, user=False, email=False, password=False, user_defau
|
||||
return dialog
|
||||
|
||||
def dialog_info(item, scraper):
|
||||
class TitleOrIDWindow(xbmcgui.WindowXMLDialog):
|
||||
def Start(self, item, scraper):
|
||||
self.item = item
|
||||
self.item.exit = False
|
||||
self.title = item.show if item.show else item.fulltitle
|
||||
self.id = item.infoLabels.get('tmdb_id', '') if scraper == 'tmdb' else item.infoLabels.get('tvdb_id', '')
|
||||
self.scraper = scraper
|
||||
self.label = 'TMDB ID:' if scraper == 'tmdb' else 'TVDB ID:'
|
||||
self.doModal()
|
||||
return self.item
|
||||
|
||||
def onInit(self):
|
||||
#### Kodi 18 compatibility ####
|
||||
if config.get_platform(True)['num_version'] < 18:
|
||||
self.setCoordinateResolution(2)
|
||||
self.getControl(10000).setText(config.get_localized_string(60228) % self.title)
|
||||
self.getControl(10001).setText(self.title)
|
||||
self.getControl(10002).setLabel(self.label)
|
||||
self.getControl(10002).setText(self.id)
|
||||
self.getControl(10002).setType(1, self.label)
|
||||
self.setFocusId(10001)
|
||||
|
||||
def onClick(self, control):
|
||||
if control in [10003]:
|
||||
if self.getControl(10001).getText():
|
||||
if self.scraper == 'tmdb':
|
||||
self.item.contentTitle = self.getControl(10001).getText()
|
||||
else:
|
||||
self.item.contentSerieName = self.getControl(10001).getText()
|
||||
if self.scraper == 'tmdb' and self.getControl(10002).getText():
|
||||
self.item.infoLabels['tmdb_id'] = self.getControl(10002).getText()
|
||||
elif self.scraper == 'tvdb' and self.getControl(10002).getText():
|
||||
self.item.infoLabels['tvdb_id'] = self.getControl(10002).getText()
|
||||
self.close()
|
||||
|
||||
elif control in [10004, 10005]:
|
||||
self.item.exit = True
|
||||
self.close()
|
||||
|
||||
def onAction(self, action):
|
||||
if (action in [92] and self.getFocusId() not in [10001, 10002]) or action in [10]:
|
||||
self.item.exit = True
|
||||
self.close()
|
||||
|
||||
dialog = TitleOrIDWindow('TitleOrIDWindow.xml', config.get_runtime_path()).Start(item, scraper)
|
||||
return dialog
|
||||
|
||||
@@ -587,11 +631,11 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
||||
|
||||
# Open the selection dialog to see the available options
|
||||
opciones, video_urls, seleccion, salir = get_dialogo_opciones(item, default_action, strm, autoplay)
|
||||
if salir: return
|
||||
if salir: exit()
|
||||
|
||||
# get default option of addon configuration
|
||||
seleccion = get_seleccion(default_action, opciones, seleccion, video_urls)
|
||||
if seleccion < 0: return # Canceled box
|
||||
if seleccion < 0: exit() # Canceled box
|
||||
|
||||
logger.debug("selection=%d" % seleccion)
|
||||
logger.debug("selection=%s" % opciones[seleccion])
|
||||
@@ -848,13 +892,14 @@ def get_dialogo_opciones(item, default_action, strm, autoplay):
|
||||
if not autoplay:
|
||||
if item.server != "":
|
||||
if "<br/>" in motivo:
|
||||
ret = dialog_yesno(config.get_localized_string(60362), motivo.split("<br/>")[0] + '\n' + motivo.split("<br/>")[1] + '\n' + item.url, nolabel='ok', yeslabel=config.get_localized_string(70739))
|
||||
ret = dialog_yesno(config.get_localized_string(60362) % item.server, motivo.split("<br/>")[0] + '\n' + motivo.split("<br/>")[1], nolabel='ok', yeslabel=config.get_localized_string(70739))
|
||||
else:
|
||||
ret = dialog_yesno(config.get_localized_string(60362), motivo + '\n' + item.url, nolabel='ok', yeslabel=config.get_localized_string(70739))
|
||||
ret = dialog_yesno(config.get_localized_string(60362) % item.server, motivo, nolabel='ok', yeslabel=config.get_localized_string(70739))
|
||||
else:
|
||||
ret = dialog_yesno(config.get_localized_string(60362), config.get_localized_string(60363) + '\n' + config.get_localized_string(60364) + '\n' + item.url, nolabel='ok', yeslabel=config.get_localized_string(70739))
|
||||
ret = dialog_yesno(config.get_localized_string(60362) % item.server, config.get_localized_string(60363) + '\n' + config.get_localized_string(60364), nolabel='ok', yeslabel=config.get_localized_string(70739))
|
||||
if ret:
|
||||
xbmc.executebuiltin("Container.Update (%s?%s)" % (sys.argv[0], Item(action="open_browser", url=item.url).tourl()))
|
||||
xbmc.executebuiltin("Container.Update (%s?%s)" %
|
||||
(sys.argv[0], Item(action="open_browser", url=item.url).tourl()))
|
||||
if item.channel == "favorites":
|
||||
# "Remove from favorites"
|
||||
opciones.append(config.get_localized_string(30154))
|
||||
|
||||
Reference in New Issue
Block a user