Nuovi messaggi di errore, fix autoplay (wstream aveva sempre la priorità) e modifiche varie

This commit is contained in:
marco
2020-11-25 21:03:40 +01:00
parent ee11b037ab
commit f779782cdc
9 changed files with 114 additions and 63 deletions

View File

@@ -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))