episodes" in data:
- image = scrapertools.find_single_match(data, '
.*?(.*?)')
- image = "http://thetvdb.com/banners/" + image
- else:
- try:
- image = item.InfoLabels['episodio_imagen']
- except:
- image = "http://imgur.com/ZiEAVOD.png"
-
- foto = item.thumb_info
- if not ".png" in foto:
- foto = "http://imgur.com/PRiEW1D.png"
- try:
- title = item.InfoLabels['episodio_titulo']
- except:
- title = ""
- title = "[COLOR red][B]" + title + "[/B][/COLOR]"
-
- try:
- plot = "[COLOR peachpuff]" + str(item.InfoLabels['episodio_sinopsis']) + "[/COLOR]"
- except:
- plot = scrapertools.find_single_match(data, '(.*?)')
- if plot == "":
- plot = "Sin información todavia"
- try:
- rating = item.InfoLabels['episodio_vote_average']
- except:
- rating = 0
- try:
-
- if rating >= 5 and rating < 8:
- rating = "[COLOR yellow]Puntuación[/COLOR] " + "[COLOR springgreen][B]" + str(rating) + "[/B][/COLOR]"
- elif rating >= 8 and rating < 10:
- rating = "[COLOR yellow]Puntuación[/COLOR] " + "[COLOR yellow][B]" + str(rating) + "[/B][/COLOR]"
- elif rating == 10:
- rating = "[COLOR yellow]Puntuación[/COLOR] " + "[COLOR orangered][B]" + str(rating) + "[/B][/COLOR]"
- else:
- rating = "[COLOR yellow]Puntuación[/COLOR] " + "[COLOR crimson][B]" + str(rating) + "[/B][/COLOR]"
- except:
- rating = "[COLOR yellow]Puntuación[/COLOR] " + "[COLOR crimson][B]" + str(rating) + "[/B][/COLOR]"
- if "10." in rating:
- rating = re.sub(r'10\.\d+', '10', rating)
-
-
- except:
-
- title = "[COLOR red][B]LO SENTIMOS...[/B][/COLOR]"
- plot = "Este capitulo no tiene informacion..."
- plot = "[COLOR yellow][B]" + plot + "[/B][/COLOR]"
- image = "http://s6.postimg.org/ub7pb76c1/noinfo.png"
- foto = "http://s6.postimg.org/nm3gk1xox/noinfosup2.png"
- rating = ""
-
- ventana = TextBox2(title=title, plot=plot, thumbnail=image, fanart=foto, rating=rating)
- ventana.doModal()
-
-
-class TextBox2(xbmcgui.WindowDialog):
- """ Create a skinned textbox window """
-
- def __init__(self, *args, **kwargs):
- self.getTitle = kwargs.get('title')
- self.getPlot = kwargs.get('plot')
- self.getThumbnail = kwargs.get('thumbnail')
- self.getFanart = kwargs.get('fanart')
- self.getRating = kwargs.get('rating')
-
- self.background = xbmcgui.ControlImage(70, 20, 1150, 630, 'http://imgur.com/aj4qzTr.jpg')
- self.title = xbmcgui.ControlTextBox(120, 60, 430, 50)
- self.rating = xbmcgui.ControlTextBox(145, 112, 1030, 45)
- self.plot = xbmcgui.ControlTextBox(120, 150, 1056, 100)
- self.thumbnail = xbmcgui.ControlImage(120, 300, 1056, 300, self.getThumbnail)
- self.fanart = xbmcgui.ControlImage(780, 43, 390, 100, self.getFanart)
-
- self.addControl(self.background)
- self.background.setAnimations(
- [('conditional', 'effect=slide start=1000% end=0% time=1500 condition=true tween=bounce',),
- ('WindowClose', 'effect=slide delay=800 start=0% end=1000% time=800 condition=true',)])
- self.addControl(self.thumbnail)
- self.thumbnail.setAnimations([('conditional',
- 'effect=zoom start=0% end=100% delay=2700 time=1500 condition=true tween=elastic easing=inout',),
- ('WindowClose', 'effect=slide end=0,700% time=300 condition=true',)])
- self.addControl(self.plot)
- self.plot.setAnimations(
- [('conditional', 'effect=zoom delay=2000 center=auto start=0 end=100 time=800 condition=true ',), (
- 'conditional',
- 'effect=rotate delay=2000 center=auto aceleration=6000 start=0% end=360% time=800 condition=true',),
- ('WindowClose', 'effect=zoom center=auto start=100% end=-0% time=600 condition=true',)])
- self.addControl(self.fanart)
- self.fanart.setAnimations(
- [('WindowOpen', 'effect=slide start=0,-700 delay=1000 time=2500 tween=bounce condition=true',), (
- 'conditional',
- 'effect=rotate center=auto start=0% end=360% delay=3000 time=2500 tween=bounce condition=true',),
- ('WindowClose', 'effect=slide end=0,-700% time=1000 condition=true',)])
- self.addControl(self.title)
- self.title.setText(self.getTitle)
- self.title.setAnimations(
- [('conditional', 'effect=slide start=-1500% end=0% delay=1000 time=2000 condition=true tween=elastic',),
- ('WindowClose', 'effect=slide start=0% end=-1500% time=800 condition=true',)])
- self.addControl(self.rating)
- self.rating.setText(self.getRating)
- self.rating.setAnimations(
- [('conditional', 'effect=fade start=0% end=100% delay=3000 time=1500 condition=true',),
- ('WindowClose', 'effect=slide end=0,-700% time=600 condition=true',)])
- xbmc.sleep(200)
-
- try:
- self.plot.autoScroll(7000, 6000, 30000)
- except:
-
- xbmc.executebuiltin(
- 'Notification([COLOR red][B]Actualiza Kodi a su última versión[/B][/COLOR], [COLOR skyblue]para mejor info[/COLOR],8000,"https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/kodi-icon.png")')
- self.plot.setText(self.getPlot)
-
- def get(self):
- self.show()
-
- def onAction(self, action):
- if action == ACTION_PREVIOUS_MENU or action.getId() == ACTION_GESTURE_SWIPE_LEFT or action == 110 or action == 92:
- self.close()
-
-
-def test():
- return True
-
-
-def fanartv(item, id_tvdb, id, images={}):
- headers = [['Content-Type', 'application/json']]
- from core import jsontools
- if item.contentType == "movie":
- url = "http://webservice.fanart.tv/v3/movies/%s?api_key=cab16e262d72fea6a6843d679aa10300" \
- % id
- else:
- url = "http://webservice.fanart.tv/v3/tv/%s?api_key=cab16e262d72fea6a6843d679aa10300" % id_tvdb
- try:
- data = jsontools.load(scrapertools.downloadpage(url, headers=headers))
- if data and not "error message" in data:
- for key, value in data.items():
- if key not in ["name", "tmdb_id", "imdb_id", "thetvdb_id"]:
- images[key] = value
- else:
- images = []
-
- except:
- images = []
- return images
-
-
-def get_art(item):
- logger.info()
- id = item.infoLabels['tmdb_id']
- check_fanart = item.infoLabels['fanart']
- if item.contentType != "movie":
- tipo_ps = "tv"
- else:
- tipo_ps = "movie"
- if not id:
- year = item.extra
- otmdb = tmdb.Tmdb(texto_buscado=item.fulltitle, year=year, tipo=tipo_ps)
- id = otmdb.result.get("id")
-
- if id == None:
- otmdb = tmdb.Tmdb(texto_buscado=item.fulltitle, tipo=tipo_ps)
- id = otmdb.result.get("id")
- if id == None:
- if item.contentType == "movie":
- urlbing_imdb = "http://www.bing.com/search?q=%s+%s+tv+series+site:imdb.com" % (
- item.fulltitle.replace(' ', '+'), year)
- data = browser(urlbing_imdb)
- data = re.sub(r"\n|\r|\t|\s{2}| |http://ssl-proxy.my-addr.org/myaddrproxy.php/", "", data)
- subdata_imdb = scrapertools.find_single_match(data,
- '(.*?)h="ID.*?.*?TV Series')
- else:
- urlbing_imdb = "http://www.bing.com/search?q=%s+%s+site:imdb.com" % (
- item.fulltitle.replace(' ', '+'), year)
- data = browser(urlbing_imdb)
- data = re.sub(r"\n|\r|\t|\s{2}| |http://ssl-proxy.my-addr.org/myaddrproxy.php/", "", data)
- subdata_imdb = scrapertools.find_single_match(data, '(.*?)h="ID.*?')
- try:
- imdb_id = scrapertools.get_match(subdata_imdb, '(.*?)h="ID.*?.*?TV Series')
- else:
- urlbing_imdb = "http://www.bing.com/search?q=%s+%s+site:imdb.com" % (
- title.replace(' ', '+'), year)
- data = browser(urlbing_imdb)
- data = re.sub(r"\n|\r|\t|\s{2}| |http://ssl-proxy.my-addr.org/myaddrproxy.php/", "",
- data)
- subdata_imdb = scrapertools.find_single_match(data,
- '(.*?)h="ID.*?')
- try:
- imdb_id = scrapertools.get_match(subdata_imdb,
- '= 4:
- if imagenes[0] != check_fanart:
- item.fanart = imagenes[0]
- else:
- item.fanart = imagenes[1]
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart and imagenes[2] != check_fanart:
- item.extra = imagenes[1] + "|" + imagenes[2]
-
- else:
-
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart:
- item.extra = imagenes[1] + "|" + imagenes[3]
- elif imagenes[2] != check_fanart:
- item.extra = imagenes[2] + "|" + imagenes[3]
- else:
- item.extra = imagenes[3] + "|" + imagenes[3]
- elif len(imagenes) == 3:
-
- if imagenes[0] != check_fanart:
- item.fanart = imagenes[0]
- else:
- item.fanart = imagenes[1]
-
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart and imagenes[2] != check_fanart:
- item.extra = imagenes[1] + "|" + imagenes[2]
-
- else:
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart:
- item.extra = imagenes[0] + "|" + imagenes[1]
- elif imagenes[2] != check_fanart:
- item.extra = imagenes[1] + "|" + imagenes[2]
- else:
- item.extra = imagenes[1] + "|" + imagenes[1]
- elif len(imagenes) == 2:
- if imagenes[0] != check_fanart:
- item.fanart = imagenes[0]
- else:
- item.fanart = imagenes[1]
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart:
- item.extra = imagenes[0] + "|" + imagenes[1]
- else:
- item.extra = imagenes[1] + "|" + imagenes[0]
- elif len(imagenes) == 1:
- item.extra = imagenes[0] + "|" + imagenes[0]
- else:
- item.extra = item.fanart + "|" + item.fanart
- id_tvdb = ""
- else:
-
- if itmdb.result.get("external_ids").get("tvdb_id"):
- id_tvdb = itmdb.result.get("external_ids").get("tvdb_id")
- if item.temp:
- item.tvdb = id_tvdb
-
-
- else:
- id_tvdb = ""
-
- if len(imagenes) >= 6:
-
- if imagenes[0] != check_fanart:
- item.fanart = imagenes[0]
- else:
- item.fanart = imagenes[1]
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart and imagenes[2] != check_fanart:
- item.extra = imagenes[1] + "|" + imagenes[2] + "|" + imagenes[3] + "|" + imagenes[4] + "|" + \
- imagenes[5]
- else:
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart:
- item.extra = imagenes[1] + "|" + imagenes[3] + "|" + imagenes[4] + "|" + imagenes[5] + "|" + \
- imagenes[2]
- elif imagenes[2] != check_fanart:
- item.extra = imagenes[2] + "|" + imagenes[3] + "|" + imagenes[4] + "|" + imagenes[5] + "|" + \
- imagenes[1]
- else:
- item.extra = imagenes[3] + "|" + imagenes[4] + "|" + imagenes[5] + "|" + imagenes[2] + "|" + \
- imagenes[1]
- elif len(imagenes) == 5:
- if imagenes[0] != check_fanart:
- item.fanart = imagenes[0]
- else:
- item.fanart = imagenes[1]
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart and imagenes[2] != check_fanart:
- item.extra = imagenes[1] + "|" + imagenes[2] + "|" + imagenes[3] + "|" + imagenes[4]
- else:
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart:
- item.extra = imagenes[1] + "|" + imagenes[3] + "|" + imagenes[4] + "|" + imagenes[2]
- elif imagenes[2] != check_fanart:
- item.extra = imagenes[2] + "|" + imagenes[3] + "|" + imagenes[4] + "|" + imagenes[1]
- else:
- item.extra = imagenes[3] + "|" + imagenes[4] + "|" + imagenes[2] + "|" + imagenes[1]
- elif len(imagenes) == 4:
- if imagenes[0] != check_fanart:
- item.fanart = imagenes[0]
- else:
- item.fanart = imagenes[1]
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart and imagenes[2] != check_fanart:
- item.extra = imagenes[1] + "|" + imagenes[2] + "|" + imagenes[3] + "|" + imagenes[4]
- else:
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart:
- item.extra = imagenes[1] + "|" + imagenes[3] + "|" + imagenes[2]
- elif imagenes[2] != check_fanart:
- item.extra = imagenes[2] + "|" + imagenes[3] + "|" + imagenes[1]
- else:
- item.extra = imagenes[3] + "|" + imagenes[2] + "|" + imagenes[1]
-
- elif len(imagenes) == 3:
- if imagenes[0] != check_fanart:
- item.fanart = imagenes[0]
- else:
- item.fanart = imagenes[1]
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart and imagenes[2] != check_fanart:
- item.extra = imagenes[1] + "|" + imagenes[2]
- else:
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart:
- item.extra = imagenes[0] + "|" + imagenes[1]
- elif imagenes[2] != check_fanart:
- item.extra = imagenes[1] + "|" + imagenes[2]
- else:
- item.extra = imagenes[1] + "|" + imagenes[1]
- elif len(imagenes) == 2:
- if imagenes[0] != check_fanart:
- item.fanart = imagenes[0]
- else:
- item.fanart = imagenes[1]
- if imagenes[1] != check_fanart and imagenes[1] != item.fanart:
- item.extra = imagenes[0] + "|" + imagenes[1]
- else:
- item.extra = imagenes[1] + "|" + imagenes[0]
- elif len(imagenes) == 1:
- item.extra = imagenes[0] + "|" + imagenes[0]
- else:
- item.extra = item.fanart + "|" + item.fanart
- item.extra = item.extra
- images_fanarttv = fanartv(item, id_tvdb, id)
- if images_fanarttv:
- if item.contentType == "movie":
- if images_fanarttv.get("moviedisc"):
- item.thumbnail = images_fanarttv.get("moviedisc")[0].get("url")
- elif images_fanarttv.get("hdmovielogo"):
- item.thumbnail = images_fanarttv.get("hdmovielogo")[0].get("url")
- elif images_fanarttv.get("moviethumb"):
- item.thumbnail = images_fanarttv.get("moviethumb")[0].get("url")
- elif images_fanarttv.get("moviebanner"):
- item.thumbnail_ = images_fanarttv.get("moviebanner")[0].get("url")
- else:
- item.thumbnail = item.thumbnail
- else:
-
- if images_fanarttv.get("hdtvlogo"):
- item.thumbnail = images_fanarttv.get("hdtvlogo")[0].get("url")
- elif images_fanarttv.get("clearlogo"):
- item.thumbnail = images_fanarttv.get("clearlogo")[0].get("url")
- item.thumb_info = item.thumbnail
- if images_fanarttv.get("hdclearart"):
- item.thumb_art = images_fanarttv.get("hdclearart")[0].get("url")
- elif images_fanarttv.get("tvbanner"):
- item.thumb_art = images_fanarttv.get("tvbanner")[0].get("url")
- else:
- item.thumb_art = item.thumbnail
-
- else:
- item.extra = item.extra + "|" + item.thumbnail
-
-
def get_year(url):
data = httptools.downloadpage(url).data
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)