Nuovo Autorenumber
+ Migliorie TVDB + Migliorie TMDB
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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()
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import xbmcgui
|
||||
import xbmcgui, sys
|
||||
|
||||
from core.tmdb import Tmdb
|
||||
from platformcode import config, logger
|
||||
from core import filetools
|
||||
if sys.version_info[0] >= 3:
|
||||
from concurrent import futures
|
||||
else:
|
||||
from concurrent_py2 import futures
|
||||
|
||||
BACKGROUND = 30000
|
||||
LOADING = 30001
|
||||
SELECT = 30002
|
||||
EXIT = 10
|
||||
BACKSPACE = 92
|
||||
|
||||
def imagepath(image):
|
||||
if len(image.split('.')) == 1: image += '.png'
|
||||
@@ -28,20 +34,27 @@ class InfoWindow(xbmcgui.WindowXMLDialog):
|
||||
logger.info('RESPONSE',self.response)
|
||||
return self.response
|
||||
|
||||
def make_items(self, i, result):
|
||||
infoLabels = self.scraper().get_infoLabels(origen=result)
|
||||
it = xbmcgui.ListItem(infoLabels['title'])
|
||||
it.setProperty('fanart', infoLabels.get('fanart', ''))
|
||||
it.setProperty('thumbnail', infoLabels.get('thumbnail', imagepath('movie' if infoLabels['mediatype'] == 'movie' else 'tv')))
|
||||
it.setProperty('genre', infoLabels.get('genre', 'N/A'))
|
||||
it.setProperty('rating', str(infoLabels.get('rating', 'N/A')))
|
||||
it.setProperty('plot', str(infoLabels.get('plot', '')))
|
||||
it.setProperty('year', str(infoLabels.get('year', '')))
|
||||
it.setProperty('position', str(i))
|
||||
return it
|
||||
|
||||
def onInit(self):
|
||||
if config.get_platform(True)['num_version'] < 18:
|
||||
self.setCoordinateResolution(2)
|
||||
|
||||
for result in self.results:
|
||||
infoLabels = self.scraper().get_infoLabels(origen=result)
|
||||
it = xbmcgui.ListItem(infoLabels['title'])
|
||||
it.setProperty('fanart', infoLabels.get('fanart', ''))
|
||||
it.setProperty('thumbnail', infoLabels.get('thumbnail', imagepath('movie' if infoLabels['mediatype'] == 'movie' else 'tv')))
|
||||
it.setProperty('genre', infoLabels.get('genre', 'N/A'))
|
||||
it.setProperty('rating', str(infoLabels.get('rating', 'N/A')))
|
||||
it.setProperty('plot', str(infoLabels.get('plot', '')))
|
||||
it.setProperty('year', str(infoLabels.get('year', '')))
|
||||
self.items.append(it)
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
for i, result in enumerate(self.results):
|
||||
logger.info(result)
|
||||
if ('seriesName' in result and result['seriesName']) or ('name' in result and result['name']) or ('title' in result and result['title']):
|
||||
self.items += [executor.submit(self.make_items, i, result).result()]
|
||||
self.items.sort(key=lambda it: int(it.getProperty('position')))
|
||||
|
||||
self.getControl(SELECT).addItems(self.items)
|
||||
self.getControl(BACKGROUND).setImage(self.items[0].getProperty('fanart'))
|
||||
@@ -53,3 +66,12 @@ class InfoWindow(xbmcgui.WindowXMLDialog):
|
||||
self.response = self.results[self.getControl(SELECT).getSelectedPosition()]
|
||||
self.close()
|
||||
|
||||
def onAction(self, action):
|
||||
if self.getFocusId() in [SELECT]:
|
||||
fanart = self.getControl(self.getFocusId()).getSelectedItem().getProperty('fanart')
|
||||
self.getControl(BACKGROUND).setImage(fanart)
|
||||
if action in [BACKSPACE]:
|
||||
self.close()
|
||||
elif action in [EXIT]:
|
||||
self.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user