Nuovo Autorenumber

+ Migliorie TVDB
 + Migliorie TMDB
This commit is contained in:
Alhaziel01
2020-11-06 19:41:28 +01:00
parent 8caad5f96c
commit 9bd8764805
32 changed files with 1800 additions and 783 deletions

View File

@@ -178,6 +178,10 @@ def dialog_register(heading, user=False, email=False, password=False, user_defau
dialog = Register('Register.xml', config.get_runtime_path()).Start(heading, user, email, password, user_default, email_default, password_default, captcha_img)
return dialog
def dialog_info(item, scraper):
dialog = TitleOrIDWindow('TitleOrIDWindow.xml', config.get_runtime_path()).Start(item, scraper)
return dialog
def itemlist_refresh():
# pos = Item().fromurl(xbmc.getInfoLabel('ListItem.FileNameAndPath')).itemlistPosition
@@ -1338,3 +1342,108 @@ def get_platform():
ret["arch"] = "arm"
return ret
class Register(xbmcgui.WindowXMLDialog):
def Start(self, heading, user, email, password, user_default, email_default, password_default, captcha_img):
self.result = {}
self.heading = heading
self.user = user
self.email = email
self.password = password
self.user_default = user_default
self.email_default = email_default
self.password_default = password_default
self.captcha_img = captcha_img
self.doModal()
return self.result
def __init__(self, *args, **kwargs):
self.mensaje = kwargs.get("mensaje")
self.imagen = kwargs.get("imagen")
def onInit(self):
#### Kodi 18 compatibility ####
if config.get_platform(True)['num_version'] < 18:
self.setCoordinateResolution(2)
height = 90
self.getControl(10002).setText(self.heading)
if self.user:
self.getControl(10003).setText(self.user_default)
height+=70
else:
self.getControl(10003).setVisible(False)
if self.email:
self.getControl(10004).setText(self.email_default)
height+=70
else:
self.getControl(10004).setVisible(False)
if self.password:
self.getControl(10005).setText(self.password_default)
height+=70
else:
self.getControl(10005).setVisible(False)
if self.captcha_img:
self.getControl(10007).setImage(self.captcha_img)
height+=240
else:
self.getControl(10005).setVisible(False)
height +=40
if height < 250: height = 250
self.getControl(10000).setHeight(height)
self.getControl(10001).setHeight(height)
self.getControl(10000).setPosition(255, (720-height)/2)
self.setFocusId(30000)
def onClick(self, control):
if control in [10010]:
self.close()
elif control in [10009]:
if self.user: self.result['user'] = self.getControl(10003).getText()
if self.email: self.result['email'] = self.getControl(10004).getText()
if self.password: self.result['password'] = self.getControl(10005).getText()
if self.captcha_img: self.result['captcha'] = self.getControl(10006).getText()
self.close()
class TitleOrIDWindow(xbmcgui.WindowXMLDialog):
def Start(self, item, scraper):
self.item = item
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():
self.item.contentTitle = 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 = None
self.close()
def onAction(self, action):
if (action in [92] and self.getFocusId() not in [10001, 10002]) or action in [10]:
self.item = None
self.close()