Nuovo Autorenumber
+ Migliorie TVDB + Migliorie TMDB
This commit is contained in:
@@ -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