- Migliorie InfoPlus

- Fix Ricerca Globale
- Inizio riscrittura Ricerca Alternativa
This commit is contained in:
Alhaziel01
2021-09-17 19:11:20 +02:00
parent b80e6295ff
commit 7196425322
14 changed files with 458 additions and 180 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
<summary lang="it">Kodi on Demand è un addon di Kodi per cercare e guardare contenuti sul web.</summary> <summary lang="it">Kodi on Demand è un addon di Kodi per cercare e guardare contenuti sul web.</summary>
<assets> <assets>
<icon>resources/media/logo.png</icon> <icon>resources/media/logo.png</icon>
<fanart>resources/media/fanart.jpg</fanart> <fanart>resources/media/dark_background.jpg</fanart>
<screenshot>resources/media/screenshot-1.png</screenshot> <screenshot>resources/media/screenshot-1.png</screenshot>
<screenshot>resources/media/screenshot-2.png</screenshot> <screenshot>resources/media/screenshot-2.png</screenshot>
<screenshot>resources/media/screenshot-3.png</screenshot> <screenshot>resources/media/screenshot-3.png</screenshot>
+13 -4
View File
@@ -890,11 +890,20 @@ def nextPage(itemlist, item, function_or_level=1, **kwargs):
# create Item # create Item
if next_page or page: if next_page or page:
itemlist.append(item.clone(action = inspect.stack()[function_or_level][3] if type(function_or_level) == int else function_or_level, itemlist.append(item.clone(action = inspect.stack()[function_or_level][3] if type(function_or_level) == int else function_or_level,
title=typo(config.get_localized_string(30992), 'color kod bold'), title=typo(config.get_localized_string(90006), 'color kod bold'),
nextPage=True, nextPage=True,
page=page if page else item.page + 1 if item.page else 2, page=page if page else item.page + 1 if item.page else 2,
prevthumb = item.thumbnail, prevthumb = item.thumbnail,
thumbnail=thumb())) thumbnail=thumb()))
if total_pages:
itemlist.append(item.clone(action='gotopage',
real_action = inspect.stack()[function_or_level][3] if type(function_or_level) == int else function_or_level,
title=typo(config.get_localized_string(90007), 'color kod bold'),
nextPage=True,
total_pages = total_pages,
page=page if page else item.page + 1 if item.page else 2,
prevthumb = item.thumbnail,
thumbnail=thumb()))
return itemlist return itemlist
@@ -957,7 +966,7 @@ def season_pagination(itemlist, item, seasons, function_level=1):
itlist.append( itlist.append(
Item(channel=item.channel, Item(channel=item.channel,
action=action, action=action,
title=typo('Stagione Successiva [{}]'.format(seasons[item.nextSeason + 1]), 'bold'), title=typo(config.get_localized_string(90008), 'color kod bold'),
allSeasons = seasons, allSeasons = seasons,
nextSeason = item.nextSeason + 1, nextSeason = item.nextSeason + 1,
itemlist = True, itemlist = True,
@@ -967,7 +976,7 @@ def season_pagination(itemlist, item, seasons, function_level=1):
Item(channel=item.channel, Item(channel=item.channel,
action='gotoseason', action='gotoseason',
real_action=action, real_action=action,
title=typo('Vai alla stagione…', 'bold'), title=typo(config.get_localized_string(90009), 'color kod bold'),
allSeasons = seasons, allSeasons = seasons,
nextSeason = item.nextSeason + 1, nextSeason = item.nextSeason + 1,
itemlist = True, itemlist = True,
@@ -1310,7 +1319,7 @@ def addQualityTag(item, itemlist, data, patron):
def thumb(data=None, mode=None): def thumb(data=None, mode=None):
''' '''
data = str, item or itemlist data = str, item or itemlist
mode = str, genre, live, quality mode = genre, live, quality
''' '''
if mode == 'live': if mode == 'live':
+86 -42
View File
@@ -3,31 +3,25 @@
# infoplus window with item information # infoplus window with item information
# ------------------------------------------------------------ # ------------------------------------------------------------
from typing import List import xbmc, xbmcgui, sys
import xbmc, xbmcgui, sys, requests, re from core import httptools, tmdb
from core import httptools, support, tmdb, filetools, channeltools, servertools, jsontools
from core.item import Item from core.item import Item
from platformcode import config, platformtools, logger, xbmc_videolibrary from platformcode import config, platformtools, logger
from platformcode.logger import log
from core.scrapertools import decodeHtmlentities, htmlclean
from core.support import typo, dbg from core.support import match, typo, dbg
PY3 = False
if sys.version_info[0] >= 3: PY3 = True
if PY3: from concurrent import futures
else: from concurrent_py2 import futures
info_list = [] info_list = []
SearchWindows = [] SearchWindows = []
api = 'k_0tdb8a8y'
# Control ID # Control ID
LIST = 100 LIST = 100
CAST = 101 CAST = MOVIE = 101
RECOMANDED = 102 SET = SHOW = 102
TRAILERS = 103 RECOMANDED = 103
FANARTS = 104 TRAILERS = 104
FANARTS = 105
SEARCH = 200 SEARCH = 200
@@ -61,6 +55,7 @@ class InfoPlus(xbmcgui.WindowXML):
self.trailers = [] self.trailers = []
self.images = [] self.images = []
self.fanarts = [] self.fanarts = []
self.collection = []
if not self.item.focus: self.item.focus = {} if not self.item.focus: self.item.focus = {}
platformtools.dialog_busy(True) platformtools.dialog_busy(True)
if self.item: if self.item:
@@ -94,8 +89,6 @@ class InfoPlus(xbmcgui.WindowXML):
# Set infoLabels # Set infoLabels
platformtools.set_infolabels(self.listitem, self.item) platformtools.set_infolabels(self.listitem, self.item)
# Add Cast Info # Add Cast Info
for cast in self.info.get('castandrole',[]): for cast in self.info.get('castandrole',[]):
castitem = xbmcgui.ListItem(cast[0], cast[1]) castitem = xbmcgui.ListItem(cast[0], cast[1])
@@ -104,6 +97,21 @@ class InfoPlus(xbmcgui.WindowXML):
self.cast.append(castitem) self.cast.append(castitem)
self.cast.sort(key=lambda c: c.getProperty('order')) self.cast.sort(key=lambda c: c.getProperty('order'))
if self.info.get('setid'):
url = '{}/collection/{}?api_key={}&language={}'.format(tmdb.host, self.info.get('setid'), tmdb.api, tmdb.def_lang)
parts = match(url).response.json['parts']
for part in parts:
poster = 'https://image.tmdb.org/t/p/original/' + part.get('poster_path') if part.get('poster_path') else ''
setitem = xbmcgui.ListItem(part.get('title'), self.info.get('set'))
setitem.setArt({'poster': poster})
rating = part.get('vote_average', 'N/A')
color = 'FFFFFFFF' if rating == 'N/A' else 'FFDB2360' if rating < 4 else 'FFD2D531' if rating < 7 else 'FF21D07A'
setitem.setProperties({'id':part.get('id'), 'mediatype':'movie', 'color':color})
setitem.setInfo("video", {'plot':self.info.get('setoverview'), 'rating':rating})
self.collection.append(setitem)
directors = self.info.get('director') directors = self.info.get('director')
if directors: if directors:
for i, director in enumerate(directors.split(',')): for i, director in enumerate(directors.split(',')):
@@ -137,6 +145,9 @@ class InfoPlus(xbmcgui.WindowXML):
self.getControl(TRAILERS).addItems(self.trailers) self.getControl(TRAILERS).addItems(self.trailers)
self.getControl(FANARTS).addItems(self.fanarts) self.getControl(FANARTS).addItems(self.fanarts)
if self.collection:
self.getControl(SET).addItems(self.collection)
# Set Focus # Set Focus
if self.item.focus: if self.item.focus:
for k, v in self.item.focus.items(): for k, v in self.item.focus.items():
@@ -149,13 +160,26 @@ class InfoPlus(xbmcgui.WindowXML):
def onAction(self, action): def onAction(self, action):
action = action.getId() action = action.getId()
focus = self.getFocusId() focus = self.getFocusId()
infoList = [LIST, CAST, SET, RECOMANDED, TRAILERS, FANARTS]
actionList = [SEARCH, BACK, CLOSE]
if action in [EXIT]: if action in [EXIT]:
self.close() self.close()
elif action in [BACKSPACE]: elif action in [BACKSPACE]:
back(self) back(self)
elif action in [UP, DOWN, LEFT, RIGHT] and focus not in [LIST, CAST, RECOMANDED, TRAILERS, FANARTS, SEARCH, BACK, CLOSE]: elif action in [UP, DOWN]:
self.setFocusId(LIST) A = 1 if action == DOWN else -1
if focus > 0 and focus not in [SEARCH, BACK, CLOSE]: if focus not in infoList or focus in actionList:
self.setFocusId(infoList[0])
elif focus + A in infoList and not focus in actionList:
while focus in infoList:
focus += A
if self.getControl(focus).isVisible():
self.setFocusId(focus)
break
else:
self.setFocusId(SEARCH)
if focus > 0 and focus not in actionList:
self.item.setFocus = focus self.item.setFocus = focus
self.item.focus[focus] = self.getControl(focus).getSelectedPosition() self.item.focus[focus] = self.getControl(focus).getSelectedPosition()
@@ -164,13 +188,23 @@ class InfoPlus(xbmcgui.WindowXML):
global info_list global info_list
if control in [SEARCH]: if control in [SEARCH]:
from specials.globalsearch import new_search selection = 0
original = self.item.infoLabels.get('originaltitle')
if self.item.contentType == 'episode': if self.item.contentType == 'episode':
self.item.contentType = 'tvshow' self.item.contentType = 'tvshow'
self.item.text = self.item.contentSerieName self.item.text = self.item.contentSerieName
self.item.mode = 'all' else:
self.item.type = self.item.contentType self.item.text = self.item.contentTitle
new_search(self.item) titles = [self.item.text] + [original] if original else []
if original and original != self.item.text:
selection = platformtools.dialog_select(config.get_localized_string(90010), titles)
if selection > -1:
self.item.text = titles[selection]
self.item.mode = 'search_' + self.item.contentType
item = self.item.clone(channel='globalsearch', action='new_search')
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?" + item.tourl() + ")")
# new_search(self.item.clone())
elif control in [CLOSE]: elif control in [CLOSE]:
self.close() self.close()
@@ -185,9 +219,9 @@ class InfoPlus(xbmcgui.WindowXML):
self.close() self.close()
showCast(it) showCast(it)
elif control in [RECOMANDED]: elif control in [RECOMANDED, SET]:
info_list.append(self.item) info_list.append(self.item)
listitem = self.getControl(RECOMANDED).getSelectedItem() listitem = self.getControl(control).getSelectedItem()
it = Item(title=listitem.getLabel(), infoLabels={'tmdb_id':listitem.getProperty('id'), 'mediatype':listitem.getProperty('mediatype')}) it = Item(title=listitem.getLabel(), infoLabels={'tmdb_id':listitem.getProperty('id'), 'mediatype':listitem.getProperty('mediatype')})
self.close() self.close()
start(it) start(it)
@@ -255,8 +289,6 @@ class CastWindow(xbmcgui.WindowXML):
self.item = kwargs.get('item') self.item = kwargs.get('item')
self.id = self.item.id self.id = self.item.id
self.item.InfoWindow = 'cast' self.item.InfoWindow = 'cast'
self.host = tmdb.host
self.api = tmdb.api
self.movies = [] self.movies = []
self.tvshows = [] self.tvshows = []
self.movieItems = [] self.movieItems = []
@@ -271,8 +303,8 @@ class CastWindow(xbmcgui.WindowXML):
def get_person_info(self): def get_person_info(self):
# Function for Person Info # Function for Person Info
url = '{}/person/{}?api_key={}&language=en'.format(self.host, self.id, self.api) url = '{}/person/{}?api_key={}&language=en'.format(tmdb.host, self.id, tmdb.api)
translation_url = '{}/person/{}/translations?api_key={}'.format(self.host, self.id, self.api) translation_url = '{}/person/{}/translations?api_key={}'.format(tmdb.host, self.id, tmdb.api)
info = httptools.downloadpage(url).json info = httptools.downloadpage(url).json
@@ -295,8 +327,8 @@ class CastWindow(xbmcgui.WindowXML):
def onInit(self): def onInit(self):
self.getControl(LIST).addItem(self.castitem) self.getControl(LIST).addItem(self.castitem)
self.getControl(CAST).addItems(self.movies) self.getControl(MOVIE).addItems(self.movies)
self.getControl(RECOMANDED).addItems(self.tvshows) self.getControl(SHOW).addItems(self.tvshows)
# Set Focus # Set Focus
xbmc.sleep(200) xbmc.sleep(200)
@@ -309,17 +341,29 @@ class CastWindow(xbmcgui.WindowXML):
def onAction(self, action): def onAction(self, action):
action = action.getId() action = action.getId()
focus = self.getFocusId() focus = self.getFocusId()
infoList = [LIST, MOVIE, SHOW]
actionList = [BACK, CLOSE]
if action in [EXIT]: if action in [EXIT]:
self.close() self.close()
elif action in [BACKSPACE]: elif action in [BACKSPACE]:
back(self) back(self)
elif action in [UP, DOWN, LEFT, RIGHT] and focus not in [LIST, CAST, RECOMANDED, TRAILERS, FANARTS, SEARCH, BACK, CLOSE]: elif action in [UP, DOWN] and focus in infoList + actionList:
self.setFocusId(LIST) A = 1 if action == DOWN else -1
if focus > 0: if focus not in infoList or focus in actionList:
self.setFocusId(infoList[0])
elif focus + A in infoList and not focus in actionList:
while focus in infoList:
focus += A
if self.getControl(focus).isVisible():
self.setFocusId(focus)
break
else:
self.setFocusId(BACK)
if focus > 0 and focus not in actionList:
self.item.setFocus = focus self.item.setFocus = focus
self.item.focus[focus] = self.getControl(focus).getSelectedPosition() self.item.focus[focus] = self.getControl(focus).getSelectedPosition()
def onClick(self, control): def onClick(self, control):
global info_list global info_list
@@ -329,20 +373,20 @@ class CastWindow(xbmcgui.WindowXML):
elif control in [BACK]: elif control in [BACK]:
back(self) back(self)
elif control in [CAST]: elif control in [MOVIE]:
info_list.append(self.item) info_list.append(self.item)
self.close() self.close()
start(self.movieItems[self.getControl(CAST).getSelectedPosition()]) start(self.movieItems[self.getControl(MOVIE).getSelectedPosition()])
elif control in [RECOMANDED]: elif control in [SHOW]:
info_list.append(self.item) info_list.append(self.item)
self.close() self.close()
start(self.tvshowItems[self.getControl(RECOMANDED).getSelectedPosition()]) start(self.tvshowItems[self.getControl(SHOW).getSelectedPosition()])
def get_credits(self): def get_credits(self):
# Function for Credits Info # Function for Credits Info
url = '{}/person/{}/combined_credits?api_key={}&language=it'.format(self.host, self.id, self.api) url = '{}/person/{}/combined_credits?api_key={}&language='.format(tmdb.host, self.id, tmdb.api, tmdb.def_lang)
info = httptools.downloadpage(url).json info = httptools.downloadpage(url).json
for video in info.get('cast',[]) + info.get('crew',[]): for video in info.get('cast',[]) + info.get('crew',[]):
+3 -1
View File
@@ -151,6 +151,7 @@ def run(item=None):
else: else:
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % "\n".join([item.url[j:j+57] for j in range(0, len(item.url), 57)])) platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % "\n".join([item.url[j:j+57] for j in range(0, len(item.url), 57)]))
elif item.action == "gotopage": elif item.action == "gotopage":
# from core.support import dbg;dbg()
from core import scrapertools from core import scrapertools
head = config.get_localized_string(70511) head = config.get_localized_string(70511)
scraped_page = scrapertools.find_single_match(item.url,'[=/]([0-9]+)') scraped_page = scrapertools.find_single_match(item.url,'[=/]([0-9]+)')
@@ -166,7 +167,8 @@ def run(item=None):
item.page = page item.page = page
import re import re
item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>{}\g<2>'.format(page), item.url) item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>{}\g<2>'.format(page), item.url)
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl())) run(item)
# xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
elif item.action == "gotoseason": elif item.action == "gotoseason":
head = 'Seleziona la stagione' head = 'Seleziona la stagione'
seasons = [str(s) for s in item.allSeasons] seasons = [str(s) for s in item.allSeasons]
@@ -6535,3 +6535,24 @@ msgstr "No options"
msgctxt "#90005" msgctxt "#90005"
msgid "Search on KOD" msgid "Search on KOD"
msgstr "Search with KOD" msgstr "Search with KOD"
msgctxt "#90006"
msgid "Next page >"
msgstr ""
msgctxt "#90007"
msgid "Go to page…"
msgstr ""
msgctxt "#90008"
msgid "Next Season >"
msgstr ""
msgctxt "#90009"
msgid "Go to season…"
msgstr ""
msgctxt "#90010"
msgid "What title do you want to search for?"
msgstr ""
@@ -6536,3 +6536,24 @@ msgstr "Nessuna opzione possibile"
msgctxt "#90005" msgctxt "#90005"
msgid "Search on KOD" msgid "Search on KOD"
msgstr "Cerca con KOD" msgstr "Cerca con KOD"
msgctxt "#90006"
msgid "Next page >"
msgstr "Pagina successiva >"
msgctxt "#90007"
msgid "Go to page…"
msgstr "Vai a pagina…"
msgctxt "#90008"
msgid "Next Season >"
msgstr "Stagione successiva >"
msgctxt "#90009"
msgid "Go to season…"
msgstr "Vai alla stagione…"
msgctxt "#90010"
msgid "What title do you want to search for?"
msgstr "Quale titolo vuoi cercare?"
Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

+10 -33
View File
@@ -97,8 +97,6 @@
<orientation>horizontal</orientation> <orientation>horizontal</orientation>
<itemlayout/> <itemlayout/>
<focusedlayout/> <focusedlayout/>
<onup>201</onup>
<ondown>101</ondown>
</control> </control>
<control type='textbox'> <control type='textbox'>
<description>Birth</description> <description>Birth</description>
@@ -134,7 +132,7 @@
<!-- Movie --> <!-- Movie -->
<control type='group'> <control type='group'>
<description>Movie Group</description> <description>Movie Group</description>
<!-- <visible>Integer.IsGreater(Container(102).NumItems, 0)</visible> --> <visible>Integer.IsGreater(Container(102).NumItems, 0)</visible>
<height>241</height> <height>241</height>
<control type='textbox'> <control type='textbox'>
<description>Movie Title</description> <description>Movie Title</description>
@@ -143,15 +141,14 @@
<font>font13</font> <font>font13</font>
<textcolor>ffFFFFFF</textcolor> <textcolor>ffFFFFFF</textcolor>
<shadowcolor>00000000</shadowcolor> <shadowcolor>00000000</shadowcolor>
<label>Movie</label> <label>$ADDON[plugin.video.kod 30122]</label>
<align>left</align> <align>left</align>
<aligny>center</aligny> <aligny>center</aligny>
</control> </control>
<control type='fixedlist' id='101'> <control type='fixedlist' id='101'>
<description>Movie List</description> <description>Movie List</description>
<visible>Integer.IsGreater(Container(102).NumItems, 0)</visible>
<top>30</top> <top>30</top>
<onup>100</onup>
<ondown>102</ondown>
<height>200</height> <height>200</height>
<orientation>horizontal</orientation> <orientation>horizontal</orientation>
<itemgap>10</itemgap> <itemgap>10</itemgap>
@@ -236,25 +233,16 @@
<control type='textbox'> <control type='textbox'>
<description>Rating</description> <description>Rating</description>
<top>20</top> <top>20</top>
<right>50</right> <right>15</right>
<width>40</width> <width>40</width>
<height>30</height> <height>30</height>
<font>font13</font> <font>font13</font>
<textcolor>ffFFFFFF</textcolor> <textcolor>Container(101).ListItem.Property(color)</textcolor>
<shadowcolor>00000000</shadowcolor> <shadowcolor>00000000</shadowcolor>
<label>[B]$INFO[Container(101).ListItem.Rating][/B]</label> <label>[B]$INFO[Container(101).ListItem.Rating][/B]</label>
<align>right</align> <align>right</align>
<aligny>center</aligny> <aligny>center</aligny>
</control> </control>
<control type='image'>
<description>Rating Circle</description>
<top>20</top>
<right>15</right>
<width>30</width>
<height>30</height>
<texture colordiffuse='$INFO[Container(101).ListItem.Property(color)]'>Circular/$INFO[Container(101).ListItem.Property(rating)].png</texture>
<aspectratio>scale</aspectratio>
</control>
</control> </control>
<control type='image'> <control type='image'>
<description>Separator</description> <description>Separator</description>
@@ -267,7 +255,7 @@
<!-- Show --> <!-- Show -->
<control type='group'> <control type='group'>
<description>Show Group</description> <description>Show Group</description>
<!-- <visible>Integer.IsGreater(Container(102).NumItems, 0)</visible> --> <visible>Integer.IsGreater(Container(102).NumItems, 0)</visible>
<height>241</height> <height>241</height>
<control type='textbox'> <control type='textbox'>
<description>Show Title</description> <description>Show Title</description>
@@ -276,14 +264,14 @@
<font>font13</font> <font>font13</font>
<textcolor>ffFFFFFF</textcolor> <textcolor>ffFFFFFF</textcolor>
<shadowcolor>00000000</shadowcolor> <shadowcolor>00000000</shadowcolor>
<label>Show</label> <label>$ADDON[plugin.video.kod 30123]</label>
<align>left</align> <align>left</align>
<aligny>center</aligny> <aligny>center</aligny>
</control> </control>
<control type='fixedlist' id='102'> <control type='fixedlist' id='102'>
<description>Show List</description> <description>Show List</description>
<visible>Integer.IsGreater(Container(102).NumItems, 0)</visible>
<top>30</top> <top>30</top>
<onup>101</onup>
<height>200</height> <height>200</height>
<orientation>horizontal</orientation> <orientation>horizontal</orientation>
<itemgap>10</itemgap> <itemgap>10</itemgap>
@@ -368,36 +356,25 @@
<control type='textbox'> <control type='textbox'>
<description>Rating</description> <description>Rating</description>
<top>20</top> <top>20</top>
<right>50</right> <right>15</right>
<width>40</width> <width>40</width>
<height>30</height> <height>30</height>
<font>font13</font> <font>font13</font>
<textcolor>ffFFFFFF</textcolor> <textcolor>Container(102).ListItem.Property(color)</textcolor>
<shadowcolor>00000000</shadowcolor> <shadowcolor>00000000</shadowcolor>
<label>[B]$INFO[Container(102).ListItem.Rating][/B]</label> <label>[B]$INFO[Container(102).ListItem.Rating][/B]</label>
<align>right</align> <align>right</align>
<aligny>center</aligny> <aligny>center</aligny>
</control> </control>
<control type='image'>
<description>Rating Circle</description>
<top>20</top>
<right>15</right>
<width>30</width>
<height>30</height>
<texture colordiffuse='$INFO[Container(102).ListItem.Property(color)]'>Circular/$INFO[Container(102).ListItem.Property(rating)].png</texture>
<aspectratio>scale</aspectratio>
</control>
</control> </control>
</control> </control>
</control> </control>
<control type='grouplist'> <control type='grouplist'>
<ondown>100</ondown>
<top>30</top> <top>30</top>
<right>30</right> <right>30</right>
<height>40</height> <height>40</height>
<width>80</width> <width>80</width>
<!-- <itemgap>10</itemgap> -->
<orientation>horizontal</orientation> <orientation>horizontal</orientation>
<control type="button" id="201"> <control type="button" id="201">
@@ -31,7 +31,7 @@
<textcolor>FFFFFFFF</textcolor> <textcolor>FFFFFFFF</textcolor>
<align>left</align> <align>left</align>
<aligny>center</aligny> <aligny>center</aligny>
<label>[B]ADDON[plugin.video.kod 70000][/B]</label> <label>[B]$ADDON[plugin.video.kod 70000][/B]</label>
</control> </control>
<control type="button" id="102"> <control type="button" id="102">
<description>Close</description> <description>Close</description>
+1 -16
View File
@@ -49,6 +49,7 @@
<control type="textbox" id='100'> <control type="textbox" id='100'>
<description>Title</description> <description>Title</description>
<visible>Control.IsVisible(500)</visible>
<left>480</left> <left>480</left>
<top>270</top> <top>270</top>
<width>1000</width> <width>1000</width>
@@ -56,7 +57,6 @@
<font>font13</font> <font>font13</font>
<textcolor>FFFFFFFF</textcolor> <textcolor>FFFFFFFF</textcolor>
<shadowcolor>00000000</shadowcolor> <shadowcolor>00000000</shadowcolor>
<!-- <visible>Integer.IsGreater(Container(101).NumItems, 0)</visible> -->
<align>left</align> <align>left</align>
<aligny>center</aligny> <aligny>center</aligny>
<animation effect="slide" tween="linear" center="0" end="-450,-240" time="600" condition="Integer.IsGreater(Container(101).NumItems, 0)">Conditional</animation> <animation effect="slide" tween="linear" center="0" end="-450,-240" time="600" condition="Integer.IsGreater(Container(101).NumItems, 0)">Conditional</animation>
@@ -674,21 +674,6 @@
<animation effect="slide" tween="linear" center="auto" end="0,-890" time="600" condition="Integer.IsGreater(Container(102).NumItems, 0)">Conditional</animation> <animation effect="slide" tween="linear" center="auto" end="0,-890" time="600" condition="Integer.IsGreater(Container(102).NumItems, 0)">Conditional</animation>
</control> </control>
<control type="label" id="501">
<description>Progress Count</description>
<top>270</top>
<left>450</left>
<width>180</width>
<height>30</height>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
<shadowcolor>00000000</shadowcolor>
<align>right</align>
<aligny>center</aligny>
<animation effect="slide" tween="linear" center="0" end="-450,-240" time="600" condition="Integer.IsGreater(Container(102).NumItems, 0)">Conditional</animation>
<!-- <visible>Control.IsVisible(500)</visible> -->
</control>
<control type="textbox"> <control type="textbox">
<description>No Results</description> <description>No Results</description>
<top>340</top> <top>340</top>
+139 -40
View File
@@ -39,6 +39,7 @@
<effect type="slide" start="0,0" end='-200,0' time="200" /> <effect type="slide" start="0,0" end='-200,0' time="200" />
</animation> </animation>
</control> </control>
<!-- Header Group --> <!-- Header Group -->
<control type='group'> <control type='group'>
<top>30</top> <top>30</top>
@@ -246,8 +247,6 @@
<orientation>horizontal</orientation> <orientation>horizontal</orientation>
<itemlayout/> <itemlayout/>
<focusedlayout/> <focusedlayout/>
<onup>200</onup>
<ondown>101</ondown>
</control> </control>
<control type='textbox'> <control type='textbox'>
<description>Cast Title</description> <description>Cast Title</description>
@@ -256,16 +255,14 @@
<font>font13</font> <font>font13</font>
<textcolor>ffFFFFFF</textcolor> <textcolor>ffFFFFFF</textcolor>
<shadowcolor>00000000</shadowcolor> <shadowcolor>00000000</shadowcolor>
<label>Cast</label> <label>$ADDON[plugin.video.kod 60501]</label>
<align>left</align> <align>left</align>
<aligny>center</aligny> <aligny>center</aligny>
</control> </control>
<control type='fixedlist' id='101'> <control type='fixedlist' id='101'>
<description>Cast List</description> <description>Cast List</description>
<visible>Integer.IsGreater(Container(101).NumItems, 0)</visible>
<top>30</top> <top>30</top>
<onup>100</onup>
<ondown>102</ondown>
<height>200</height>
<orientation>horizontal</orientation> <orientation>horizontal</orientation>
<itemgap>10</itemgap> <itemgap>10</itemgap>
<itemlayout width='133' height='200'> <itemlayout width='133' height='200'>
@@ -342,27 +339,26 @@
<texture>white.png</texture>ù <texture>white.png</texture>ù
</control> </control>
</control> </control>
<!-- Recomended --> <!-- Collection -->
<control type='group'> <control type='group'>
<description>Recomanded Group</description> <description>Collection Group</description>
<!-- <visible>Integer.IsGreater(Container(102).NumItems, 0)</visible> --> <visible>Integer.IsGreater(Container(102).NumItems, 0)</visible>
<height>241</height> <height>241</height>
<control type='textbox'> <control type='textbox'>
<description>Cast Title</description> <description>Collection Title</description>
<left>10</left> <left>10</left>
<height>30</height> <height>30</height>
<font>font13</font> <font>font13</font>
<textcolor>ffFFFFFF</textcolor> <textcolor>ffFFFFFF</textcolor>
<shadowcolor>00000000</shadowcolor> <shadowcolor>00000000</shadowcolor>
<label>Recomanded</label> <label>$INFO[Container(102).ListItem.Label2]</label>
<align>left</align> <align>left</align>
<aligny>center</aligny> <aligny>center</aligny>
</control> </control>
<control type='fixedlist' id='102'> <control type='fixedlist' id='102'>
<description>Recomanded List</description> <description>Collection List</description>
<visible>Integer.IsGreater(Container(102).NumItems, 0)</visible>
<top>30</top> <top>30</top>
<onup>101</onup>
<ondown>103</ondown>
<height>200</height> <height>200</height>
<orientation>horizontal</orientation> <orientation>horizontal</orientation>
<itemgap>10</itemgap> <itemgap>10</itemgap>
@@ -434,15 +430,6 @@
<align>right</align> <align>right</align>
<aligny>center</aligny> <aligny>center</aligny>
</control> </control>
<!-- <control type='image'>
<description>Rating Circle</description>
<top>20</top>
<right>15</right>
<width>30</width>
<height>30</height>
<texture colordiffuse='$INFO[Container(102).ListItem.Property(color)]'>Circular/$INFO[Container(102).ListItem.Property(rating)].png</texture>
<aspectratio aligny='center'>keep</aspectratio>
</control> -->
<control type='textbox'> <control type='textbox'>
<description>Plot</description> <description>Plot</description>
<top>60</top> <top>60</top>
@@ -466,10 +453,124 @@
<texture>white.png</texture> <texture>white.png</texture>
</control> </control>
</control> </control>
<!-- Recomended -->
<control type='group'>
<description>Recomanded Group</description>
<visible>Integer.IsGreater(Container(103).NumItems, 0)</visible>
<height>241</height>
<control type='textbox'>
<description>Cast Title</description>
<left>10</left>
<height>30</height>
<font>font13</font>
<textcolor>ffFFFFFF</textcolor>
<shadowcolor>00000000</shadowcolor>
<label>$ADDON[plugin.video.kod 70315]</label>
<align>left</align>
<aligny>center</aligny>
</control>
<control type='fixedlist' id='103'>
<description>Recomanded List</description>
<visible>Integer.IsGreater(Container(103).NumItems, 0)</visible>
<top>30</top>
<height>200</height>
<orientation>horizontal</orientation>
<itemgap>10</itemgap>
<itemlayout width='133' height='200'>
<control type='image'>
<texture>Infoplus/no_photo.png</texture>
<bordersize>10</bordersize>
<aspectratio>scale</aspectratio>
</control>
<control type='image'>
<texture>$INFO[ListItem.Art(poster)]</texture>
<bordersize>10</bordersize>
<aspectratio>scale</aspectratio>
</control>
</itemlayout>
<focusedlayout width='133' height='200'>
<control type='image'>
<texture colordiffuse='FF0082C2'>white.png</texture>
<bordersize>5</bordersize>
<aspectratio>scale</aspectratio>
<visible>Control.HasFocus(103)</visible>
</control>
<control type='image'>
<texture>Infoplus/no_photo.png</texture>
<bordersize>10</bordersize>
<aspectratio>scale</aspectratio>
</control>
<control type='image'>
<texture>$INFO[ListItem.Art(poster)]</texture>
<bordersize>10</bordersize>
<aspectratio>scale</aspectratio>
</control>
</focusedlayout>
</control>
<control type='group'>
<top>30</top>
<left>133</left>
<height>200</height>
<visible>Control.HasFocus(103)</visible>
<animation effect='zoom' start='0,100' center='720,0' reversible='true' time='160' condition='Control.HasFocus(103)'>Conditional</animation>
<animation effect='fade' start='0' reversible='true' time='100' condition='Control.HasFocus(103)'>Conditional</animation>
<control type='image'>
<texture colordiffuse='CC000000'>white.png</texture>
</control>
<control type='textbox'>
<description>Name</description>
<top>20</top>
<left>40</left>
<height>30</height>
<width>450</width>
<font>font13</font>
<textcolor>ffFFFFFF</textcolor>
<shadowcolor>00000000</shadowcolor>
<label>[B]$INFO[Container(103).ListItem.Label][/B]</label>
<align>left</align>
<aligny>center</aligny>
</control>
<control type='label'>
<description>Name</description>
<top>20</top>
<right>15</right>
<width>40</width>
<height>30</height>
<font>font13</font>
<scroll>true</scroll>
<textcolor>Container(103).ListItem.Property(color)</textcolor>
<shadowcolor>00000000</shadowcolor>
<label>[B]$INFO[Container(103).ListItem.Rating][/B]</label>
<align>right</align>
<aligny>center</aligny>
</control>
<control type='textbox'>
<description>Plot</description>
<top>60</top>
<left>40</left>
<height>100</height>
<width>520</width>
<font>font13</font>
<textcolor>ffFFFFFF</textcolor>
<shadowcolor>00000000</shadowcolor>
<label>$INFO[Container(103).ListItem.Plot]</label>
<autoscroll time='3000' delay='3000' repeat='3000'>True</autoscroll>
<align>left</align>
<aligny>center</aligny>
</control>
</control>
<control type='image'>
<description>Separator</description>
<top>240</top>
<left>0</left>
<height>0.5</height>
<texture>white.png</texture>
</control>
</control>
<!-- Trailers --> <!-- Trailers -->
<control type='group'> <control type='group'>
<description>Trailers Group</description> <description>Trailers Group</description>
<visible>Integer.IsGreater(Container(103).NumItems, 0)</visible> <visible>Integer.IsGreater(Container(104).NumItems, 0)</visible>
<height>241</height> <height>241</height>
<visible></visible> <visible></visible>
<control type='textbox'> <control type='textbox'>
@@ -483,11 +584,10 @@
<align>left</align> <align>left</align>
<aligny>center</aligny> <aligny>center</aligny>
</control> </control>
<control type='fixedlist' id='103'> <control type='fixedlist' id='104'>
<description>Trailers List</description> <description>Trailers List</description>
<visible>Integer.IsGreater(Container(104).NumItems, 0)</visible>
<top>30</top> <top>30</top>
<onup>102</onup>
<ondown>104</ondown>
<height>200</height> <height>200</height>
<orientation>horizontal</orientation> <orientation>horizontal</orientation>
<itemgap>10</itemgap> <itemgap>10</itemgap>
@@ -503,7 +603,7 @@
<texture colordiffuse='FF0082C2'>white.png</texture> <texture colordiffuse='FF0082C2'>white.png</texture>
<bordersize>5</bordersize> <bordersize>5</bordersize>
<aspectratio>scale</aspectratio> <aspectratio>scale</aspectratio>
<visible>Control.HasFocus(103)</visible> <visible>Control.HasFocus(104)</visible>
</control> </control>
<control type='image'> <control type='image'>
<texture>$INFO[ListItem.Art(thumb)]</texture> <texture>$INFO[ListItem.Art(thumb)]</texture>
@@ -516,9 +616,9 @@
<top>30</top> <top>30</top>
<left>340</left> <left>340</left>
<height>200</height> <height>200</height>
<visible>Control.HasFocus(103)</visible> <visible>Control.HasFocus(104)</visible>
<animation effect='zoom' start='0,100' center='720,0' reversible='true' time='160' condition='Control.HasFocus(103)'>Conditional</animation> <animation effect='zoom' start='0,100' center='720,0' reversible='true' time='160' condition='Control.HasFocus(104)'>Conditional</animation>
<animation effect='fade' start='0' reversible='true' time='100' condition='Control.HasFocus(103)'>Conditional</animation> <animation effect='fade' start='0' reversible='true' time='100' condition='Control.HasFocus(104)'>Conditional</animation>
<control type='image'> <control type='image'>
<texture colordiffuse='CC000000'>white.png</texture> <texture colordiffuse='CC000000'>white.png</texture>
</control> </control>
@@ -531,7 +631,7 @@
<font>font13</font> <font>font13</font>
<textcolor>ffFFFFFF</textcolor> <textcolor>ffFFFFFF</textcolor>
<shadowcolor>00000000</shadowcolor> <shadowcolor>00000000</shadowcolor>
<label>[B]$INFO[Container(103).ListItem.Label][/B]</label> <label>[B]$INFO[Container(104).ListItem.Label][/B]</label>
<autoscroll time='1000' delay='1000' repeat='1000'>True</autoscroll> <autoscroll time='1000' delay='1000' repeat='1000'>True</autoscroll>
<align>left</align> <align>left</align>
<aligny>center</aligny> <aligny>center</aligny>
@@ -548,7 +648,7 @@
<!-- Fanart Group --> <!-- Fanart Group -->
<control type='group'> <control type='group'>
<description>Fanart Group</description> <description>Fanart Group</description>
<visible>Integer.IsGreater(Container(104).NumItems, 0)</visible> <visible>Integer.IsGreater(Container(105).NumItems, 0)</visible>
<height>241</height> <height>241</height>
<visible></visible> <visible></visible>
<control type='textbox'> <control type='textbox'>
@@ -558,14 +658,14 @@
<font>font13</font> <font>font13</font>
<textcolor>ffFFFFFF</textcolor> <textcolor>ffFFFFFF</textcolor>
<shadowcolor>00000000</shadowcolor> <shadowcolor>00000000</shadowcolor>
<label>FANARTS</label> <label>Fanarts</label>
<align>left</align> <align>left</align>
<aligny>center</aligny> <aligny>center</aligny>
</control> </control>
<control type='fixedlist' id='104'> <control type='fixedlist' id='105'>
<description>Fanart List</description> <description>Fanart List</description>
<top>30</top> <visible>Integer.IsGreater(Container(105).NumItems, 0)</visible>
<onup>103</onup> <top>30</top>>
<height>200</height> <height>200</height>
<orientation>horizontal</orientation> <orientation>horizontal</orientation>
<itemgap>10</itemgap> <itemgap>10</itemgap>
@@ -581,7 +681,7 @@
<texture colordiffuse='FF0082C2'>white.png</texture> <texture colordiffuse='FF0082C2'>white.png</texture>
<bordersize>5</bordersize> <bordersize>5</bordersize>
<aspectratio>scale</aspectratio> <aspectratio>scale</aspectratio>
<visible>Control.HasFocus(104)</visible> <visible>Control.HasFocus(105)</visible>
</control> </control>
<control type='image'> <control type='image'>
<texture>$INFO[ListItem.Art(fanart)]</texture> <texture>$INFO[ListItem.Art(fanart)]</texture>
@@ -591,15 +691,14 @@
</focusedlayout> </focusedlayout>
</control> </control>
</control> </control>
</control> </control>
<control type='grouplist'> <control type='grouplist'>
<ondown>100</ondown>
<top>30</top> <top>30</top>
<right>30</right> <right>30</right>
<height>40</height> <height>40</height>
<width>120</width> <width>120</width>
<!-- <itemgap>10</itemgap> -->
<orientation>horizontal</orientation> <orientation>horizontal</orientation>
<control type="button" id="200"> <control type="button" id="200">
<description>search</description> <description>search</description>
+14 -15
View File
@@ -90,7 +90,7 @@ class SearchWindow(xbmcgui.WindowXML):
self.next = None self.next = None
self.previous = None self.previous = None
self.FOCUS = False self.FOCUS = False
self.mode = self.item.mode.split('_')[-1]
if not thActions and not self.searchActions: if not thActions and not self.searchActions:
self.thActions = Thread(target=self.getActionsThread) self.thActions = Thread(target=self.getActionsThread)
@@ -129,7 +129,7 @@ class SearchWindow(xbmcgui.WindowXML):
try: try:
module = __import__('channels.%s' % channel, fromlist=["channels.%s" % channel]) module = __import__('channels.%s' % channel, fromlist=["channels.%s" % channel])
mainlist = getattr(module, 'mainlist')(Item(channel=channel, global_search=True)) mainlist = getattr(module, 'mainlist')(Item(channel=channel, global_search=True))
actions = [elem for elem in mainlist if elem.action == "search" and (self.item.mode in ['all', 'person'] or elem.contentType in [self.item.mode, 'undefined'])] actions = [elem for elem in mainlist if elem.action == "search" and (self.mode in ['all', 'person'] or elem.contentType in [self.mode, 'undefined'])]
self.moduleDict[channel] = module self.moduleDict[channel] = module
self.searchActions.append(actions) self.searchActions.append(actions)
except: except:
@@ -157,20 +157,20 @@ class SearchWindow(xbmcgui.WindowXML):
logger.debug() logger.debug()
self.PROGRESS.setVisible(False) self.PROGRESS.setVisible(False)
self.items = [] self.items = []
if self.item.mode == 'filmography': if self.mode == 'filmography':
tmdb_info = tmdb.discovery(self.item, dict_=self.item.discovery) tmdb_info = tmdb.discovery(self.item, dict_=self.item.discovery)
results = tmdb_info.results.get('cast',[]) results = tmdb_info.results.get('cast',[])
else: else:
tmdb_info = tmdb.Tmdb(searched_text=self.item.text, search_type=self.item.mode.replace('show', '')) tmdb_info = tmdb.Tmdb(searched_text=self.item.text, search_type=self.mode.replace('show', ''))
results = tmdb_info.results results = tmdb_info.results
def make(n, result): def make(n, result):
result = tmdb_info.get_infoLabels(result, origen=result) result = tmdb_info.get_infoLabels(result, origen=result)
if self.item.mode == 'movie': if self.mode == 'movie':
title = result['title'] title = result['title']
result['mode'] = 'movie' result['mode'] = 'movie'
elif self.item.mode == 'tvshow': elif self.mode == 'tvshow':
title = result['name'] title = result['name']
result['mode'] = 'tvshow' result['mode'] = 'tvshow'
else: else:
@@ -189,7 +189,7 @@ class SearchWindow(xbmcgui.WindowXML):
text=title, text=title,
infoLabels=result) infoLabels=result)
if self.item.mode == 'movie': if self.mode == 'movie':
new_item.contentTitle = result['title'] new_item.contentTitle = result['title']
else: else:
new_item.contentSerieName = result['name'] new_item.contentSerieName = result['name']
@@ -284,7 +284,7 @@ class SearchWindow(xbmcgui.WindowXML):
self.setFocusId(CLOSE) self.setFocusId(CLOSE)
def get_channels(self): def get_channels(self):
logger.debug() logger.debug('MODE:', self.mode)
channels_list = [] channels_list = []
all_channels = channelselector.filterchannels('all') all_channels = channelselector.filterchannels('all')
@@ -302,7 +302,7 @@ class SearchWindow(xbmcgui.WindowXML):
n = list_cat.index('anime') n = list_cat.index('anime')
list_cat[n] = 'tvshow' list_cat[n] = 'tvshow'
if self.item.mode in ['all', 'person'] or self.item.mode in list_cat: if self.mode in ['all', 'person'] or self.mode in list_cat:
if config.get_setting("include_in_global_search", channel) and ch_param.get("active", False): if config.get_setting("include_in_global_search", channel) and ch_param.get("active", False):
channels_list.append(channel) channels_list.append(channel)
@@ -374,7 +374,7 @@ class SearchWindow(xbmcgui.WindowXML):
if not results[0].action or results[0].nextPage: if not results[0].action or results[0].nextPage:
results = [] results = []
if self.item.mode != 'all': if self.mode != 'all':
for elem in results: for elem in results:
if elem.infoLabels.get('tmdb_id') == self.item.infoLabels.get('tmdb_id'): if elem.infoLabels.get('tmdb_id') == self.item.infoLabels.get('tmdb_id'):
elem.from_channel = elem.channel elem.from_channel = elem.channel
@@ -404,7 +404,7 @@ class SearchWindow(xbmcgui.WindowXML):
dummy, valid, dummy = channel_search(self.item.text + " " + str(self.item.infoLabels['year'])) dummy, valid, dummy = channel_search(self.item.text + " " + str(self.item.infoLabels['year']))
# some channels may use original title # some channels may use original title
if self.item.mode != 'all' and not valid and self.item.infoLabels.get('originaltitle'): if self.mode != 'all' and not valid and self.item.infoLabels.get('originaltitle'):
logger.debug('retring with original title on channel ') logger.debug('retring with original title on channel ')
dummy, valid, dummy = channel_search(self.item.infoLabels.get('originaltitle')) dummy, valid, dummy = channel_search(self.item.infoLabels.get('originaltitle'))
except: except:
@@ -509,13 +509,12 @@ class SearchWindow(xbmcgui.WindowXML):
if self.item.mode.split('_')[0] in ['all', 'search']: if self.item.mode.split('_')[0] in ['all', 'search']:
if 'search' in self.item.mode: if 'search' in self.item.mode:
self.item.mode = self.item.mode.split('_')[-1]
self.item.text = scrapertools.title_unify(self.item.text) self.item.text = scrapertools.title_unify(self.item.text)
self.thread = Thread(target=self.search) self.thread = Thread(target=self.search)
self.thread.start() self.thread.start()
elif self.item.mode in ['movie', 'tvshow', 'filmography']: elif self.mode in ['movie', 'tvshow', 'filmography']:
self.select() self.select()
elif self.item.mode in ['person']: elif self.mode in ['person']:
self.actors() self.actors()
def Focus(self, focusid): def Focus(self, focusid):
@@ -612,7 +611,7 @@ class SearchWindow(xbmcgui.WindowXML):
self.close() self.close()
else: else:
item = Item().fromurl(self.RESULTS.getSelectedItem().getProperty('item')) item = Item().fromurl(self.RESULTS.getSelectedItem().getProperty('item'))
if self.item.mode == 'movie': item.contentTitle = self.RESULTS.getSelectedItem().getLabel() if self.mode == 'movie': item.contentTitle = self.RESULTS.getSelectedItem().getLabel()
else: item.contentSerieName = self.RESULTS.getSelectedItem().getLabel() else: item.contentSerieName = self.RESULTS.getSelectedItem().getLabel()
new_search(item, self.moduleDict, self.searchActions) new_search(item, self.moduleDict, self.searchActions)
+146 -25
View File
@@ -6,8 +6,8 @@ from core import filetools, jsontools, trakt_tools
from core import support, tmdb from core import support, tmdb
from core.tmdb import Tmdb from core.tmdb import Tmdb
from core.scrapertools import htmlclean, decodeHtmlentities from core.scrapertools import htmlclean, decodeHtmlentities
from core.support import thumb, typo, match, dbg from core.support import nextPage, thumb, typo, match, dbg
from platformcode import config, logger from platformcode import config, logger, platformtools
langs = Item(tmdb=[tmdb.def_lang, 'de', 'fr', 'pt', 'it', 'es-MX', 'ca', 'en', 'es'], langs = Item(tmdb=[tmdb.def_lang, 'de', 'fr', 'pt', 'it', 'es-MX', 'ca', 'en', 'es'],
@@ -24,13 +24,8 @@ mal_key = 'MzE1MDQ2cGQ5N2llYTY4Z2xwbGVzZjFzbTY='
def mainlist(item): def mainlist(item):
logger.debug() logger.debug()
itemlist = [item.clone(title='TMDB', action='tmdb_menu'), itemlist = [item.clone(title='TMDB', action='tmdbMenu', thumbnail=support.thumb('tmdb')),
item.clone(title='IMDB', action='imdb_menu')] item.clone(title='IMDB', action='imdbMenu', thumbnail=support.thumb('imdb'))]
# itemlist = [item.clone(title=config.get_localized_string(70021) % (config.get_localized_string(30122), 'TMDB'), action='tmdb_menu', args='movie'),
# item.clone(title=config.get_localized_string(70021) % (config.get_localized_string(30123), 'TMDB'), action='tmdb_menu', args='tv'),
# item.clone(title=config.get_localized_string(70021) % (config.get_localized_string(30122), 'IMDB'), action='imdb', args='movie', url='&title_type=feature,tv_movie'),
# item.clone(title=config.get_localized_string(70021) % (config.get_localized_string(30123), 'IMDB'), action='imdb', args='tv', url='&title_type=tv_series,tv_special,mini_series')]
support.thumb(itemlist)
itemlist += [item.clone(title=config.get_localized_string(70415), action='trakt', thumbnail=support.thumb('trakt')), itemlist += [item.clone(title=config.get_localized_string(70415), action='trakt', thumbnail=support.thumb('trakt')),
item.clone(title=config.get_localized_string(70026), action='mal', thumbnail=support.thumb('mal')), item.clone(title=config.get_localized_string(70026), action='mal', thumbnail=support.thumb('mal')),
item.clone(title=typo(config.get_localized_string(70027), 'bold'), action='configuracion', folder=False, thumbnail=support.thumb('setting'))] item.clone(title=typo(config.get_localized_string(70027), 'bold'), action='configuracion', folder=False, thumbnail=support.thumb('setting'))]
@@ -38,41 +33,43 @@ def mainlist(item):
def tmdb_menu(item): def tmdbMenu(item):
if not item.args: if not item.args:
return [item.clone(title=config.get_localized_string(70741) % config.get_localized_string(30122), args='movie'), return thumb([item.clone(title=config.get_localized_string(70741) % config.get_localized_string(30122), args='movie'),
item.clone(title=config.get_localized_string(70741) % config.get_localized_string(30123), args='tv')] item.clone(title=config.get_localized_string(70741) % config.get_localized_string(30123), args='tv')])
item.contentType = item.args.replace('tv', 'tvshow') item.contentType = item.args.replace('tv', 'tvshow')
itemlist = [item.clone(title=config.get_localized_string(70028), action='peliculas', args=item.args + '/popular'), itemlist = [item.clone(title=config.get_localized_string(70028), action='tmdbResults', args=item.args + '/popular'),
item.clone(title=config.get_localized_string(70029), action='peliculas', args=item.args + '/top_rated'), item.clone(title=config.get_localized_string(70029), action='tmdbResults', args=item.args + '/top_rated'),
item.clone(title=config.get_localized_string(50001), action='peliculas', args=item.args + '/now_playing' if item.args == 'movie' else '/on_the_air'), item.clone(title=config.get_localized_string(50001), action='tmdbResults', args=item.args + '/now_playing' if item.args == 'movie' else '/on_the_air'),
item.clone(title=config.get_localized_string(70032), action='indices_tmdb'), item.clone(title=config.get_localized_string(70032), action='tmdbIndex', mode='genre'),
item.clone(title=config.get_localized_string(70042), action='indices_tmdb')] item.clone(title=config.get_localized_string(70042), action='tmdbIndex', mode='year')]
if item.args == 'movie': if item.args == 'movie':
itemlist.extend([item.clone(title=config.get_localized_string(70033), action='peliculas', args='person/popular'), itemlist.extend([item.clone(title=config.get_localized_string(70033), action='tmdbResults', args='person/popular'),
item.clone(title=config.get_localized_string(70034), action='list_tmdb', args=item.args + '/upcoming')]) item.clone(title=config.get_localized_string(70034), action='tmdbResults', args=item.args + '/upcoming')])
itemlist.extend([item.clone(title=config.get_localized_string(70035) % config.get_localized_string(60244 if item.args == 'movie' else 60245).lower(), action='search_', search={'url': 'search/%s' % item.args, 'language': lang.tmdb, 'page': 1}), itemlist.extend([item.clone(title=config.get_localized_string(70035) % config.get_localized_string(60244 if item.args == 'movie' else 60245).lower(), action='_search', search={'url': 'search/%s' % item.args, 'language': lang.tmdb, 'page': 1}),
item.clone(title=config.get_localized_string(70036), action='search_', search={'url': 'search/person', 'language': lang.tmdb, 'page': 1})]) item.clone(title=config.get_localized_string(70036), action='_search', search={'url': 'search/person', 'language': lang.tmdb, 'page': 1})])
if item.args == 'movie': itemlist.append(item.clone(title=config.get_localized_string(70037), action='search_', search={'url': 'search/person', 'language': lang.tmdb, 'page': 1}, crew=True)) if item.args == 'movie': itemlist.append(item.clone(title=config.get_localized_string(70037), action='_search', search={'url': 'search/person', 'language': lang.tmdb, 'page': 1}, crew=True))
itemlist.extend([item.clone(title=typo(config.get_localized_string(70038),'bold'), action='filter', ), itemlist.extend([item.clone(title=typo(config.get_localized_string(70038),'bold'), action='filter', ),
item.clone(title=typo(config.get_localized_string(70039),'bold'), action='filter', )]) item.clone(title=typo(config.get_localized_string(70039),'bold'), action='filter', )])
return thumb(itemlist) return thumb(itemlist)
def peliculas(item):
def tmdbResults(item):
itemlist = [] itemlist = []
_search = {'url': item.args, 'language': lang.tmdb, 'page': item.page if item.page else 1} if not item.page: item.page = 1
_search = item.search if item.search else {'url': item.args, 'language': lang.tmdb, 'page': item.page}
obj = tmdb.discovery(item, _search) obj = tmdb.discovery(item, _search)
for result in obj.results: for result in obj.results:
if 'person' in item.args: if 'person' in _search['url']:
it = item.clone(action='showCast', channel='infoplus', folder=False) it = item.clone(action='showCast', channel='infoplus', folder=False)
it.id = result.get('id') it.id = result.get('id')
else: else:
@@ -81,4 +78,128 @@ def peliculas(item):
for k in ['title', 'thumbnail', 'fanart']: for k in ['title', 'thumbnail', 'fanart']:
it.__setattr__(k, it.infoLabels.get(k)) it.__setattr__(k, it.infoLabels.get(k))
itemlist.append(it) itemlist.append(it)
if item.page < obj.total_pages:
support.nextPage(itemlist, item, 'peliculas', page=item.page + 1, total_pages=obj.total_pages)
return itemlist return itemlist
def tmdbIndex(item):
itemlist = []
from datetime import datetime
if item.mode == 'genre':
url = '{}/{}/list?api_key={}&language={}'.format(tmdb.host, item.mode, tmdb.api, lang.tmdb)
genres = match(url, cookies=False).response.json['genres']
date = datetime.now().strftime('%Y-%m-%d')
sort_by = 'release_date.desc'
param_year = 'release_date.lte'
if item.contentType == 'tvshow':
sort_by = 'first_air_date.desc'
param_year = 'air_date.lte'
for genre in genres:
search = {'url': 'discover/{}'.format(item.args), 'with_genres': genre['id'], 'sort_by': sort_by, param_year: date,'language': lang.tmdb, 'page': 1}
new_item = item.clone(title=genre['name'], action='tmdbResults', search=search, mode='')
itemlist.append(new_item)
itemlist.sort(key=lambda item: item.title)
thumb(itemlist, mode='genre')
else:
year = datetime.now().year + 3
for i in range(year, 1899, -1):
if item.contentType == 'tvshow':
param_year = 'first_air_date_year'
else:
param_year = 'primary_release_year'
search = {'url': 'discover/{}'.format(item.args), param_year: i, 'language': lang.tmdb, 'page': 1}
itemlist.append(item.clone(title=str(i), action='tmdbResults', search=search))
return itemlist
def _search(item):
text = platformtools.dialog_input(heading=item.title)
if text:
item.search['query'] = text
return tmdbResults(item)
############################################################
def filter(item):
logger.debug()
from datetime import datetime
list_controls = []
valores = {}
dict_values = None
list_controls.append({'id': 'years', 'label': config.get_localized_string(60232), 'enabled': True, 'type': 'list', 'default': -1, 'visible': True})
list_controls[0]['lvalues'] = []
valores['years'] = []
year = datetime.now().year + 1
for i in range(1900, year + 1):
list_controls[0]['lvalues'].append(str(i))
valores['years'].append(str(i))
list_controls[0]['lvalues'].append(config.get_localized_string(70450))
valores['years'].append('')
if config.get_localized_string(70038) in item.title:
# Se utilizan los valores por defecto/guardados
saved_values = config.get_setting("default_filter_" + item.args, item.channel)
if saved_values:
dict_values = saved_values
# dbg()
url = '{}/genre/{}/list?api_key={}&language={}'.format(tmdb.host, item.args, tmdb.api, lang.tmdb)
# try:
lista = support.match(url, cookies=False).response.json["genres"]
if lista:
list_controls.append({'id': 'labelgenre', 'enabled': True, 'type': 'label', 'default': None, 'label': config.get_localized_string(70451), 'visible': True})
for l in lista:
list_controls.append({'id': 'genre' + str(l["id"]), 'label': l["name"], 'enabled': True, 'type': 'bool', 'default': False, 'visible': True})
# except:
# pass
list_controls.append({'id': 'orden', 'label': config.get_localized_string(70455), 'enabled': True, 'type': 'list', 'default': -1, 'visible': True})
orden = [config.get_localized_string(70456), config.get_localized_string(70457), config.get_localized_string(70458), config.get_localized_string(70459), config.get_localized_string(70460), config.get_localized_string(70461)]
if item.args == "movie":
orden.extend([config.get_localized_string(70462), config.get_localized_string(70463)])
orden_tmdb = ['popularity.desc', 'popularity.asc', 'release_date.desc', 'release_date.asc', 'vote_average.desc', 'vote_average.asc', 'original_title.asc', 'original_title.desc']
valores['orden'] = []
list_controls[-1]['lvalues'] = []
for i, tipo_orden in enumerate(orden):
list_controls[-1]['lvalues'].insert(0, tipo_orden)
valores['orden'].insert(0, orden_tmdb[i])
list_controls.append({'id': 'espacio', 'label': '', 'enabled': False, 'type': 'label', 'default': None, 'visible': True})
list_controls.append({'id': 'save', 'label': config.get_localized_string(70464), 'enabled': True, 'type': 'bool', 'default': False, 'visible': True})
else:
list_controls.append({'id': 'keyword', 'label': config.get_localized_string(70465), 'enabled': True, 'type': 'text', 'default': '', 'visible': True})
item.valores = valores
return platformtools.show_channel_settings(list_controls=list_controls, dict_values=dict_values, caption=config.get_localized_string(70320), item=item, callback='filtered')
def filtered(item, values):
values_copy = values.copy()
# Save the filter to be the one loaded by default
if "save" in values and values["save"]:
values_copy.pop("save")
config.set_setting("default_filter_" + item.args, values_copy, item.channel)
year = item.valores["years"][values["years"]]
if config.get_localized_string(70038) in item.title:
orden = item.valores["orden"][values["orden"]]
if item.args == "tv": orden = orden.replace('release_date', 'first_air_date')
genre_ids = []
for v in values:
if "genre" in v:
if values[v]: genre_ids.append(v.replace('genre', ''))
genre_ids = ",".join(genre_ids)
if config.get_localized_string(70465).lower() in item.title.lower(): item.search = {'url': 'search/%s' % item.args, 'year': year, 'query': values["keyword"], 'language': lang.tmdb, 'page': 1}
elif item.args == "movie": item.search = {'url': 'discover/%s' % item.args, 'sort_by': orden, 'primary_release_year': year, 'with_genres': genre_ids, 'vote_count.gte': '10', 'language': lang.tmdb, 'page': 1}
else: item.search = {'url': 'discover/%s' % item.args, 'sort_by': orden, 'first_air_date_year': year, 'with_genres': genre_ids, 'vote_count.gte': '10', 'language': lang.tmdb, 'page': 1}
item.action = "list_tmdb"
return tmdbResults(item)