.*?
(.*?)
')
if info:
bio = dhe(scrapertools.htmlclean(info.strip()))
- try:
- info_list = []
- while bio:
- info_list.append(bio[:1900])
- bio = bio[1900:]
- bio = []
- threads = {}
- for i, info_ in enumerate(info_list):
- t = Thread(target=translate, args=[info_, "es", "en", i, bio])
- t.setDaemon(True)
- t.start()
- threads[i] = t
-
- while threads:
- for key, t in list(threads.items()):
- if not t.isAlive():
- threads.pop(key)
- xbmc.sleep(100)
- if bio:
- bio.sort(key=lambda x: x[0])
- biography = ""
- for i, b in bio:
- biography += b
- actor_tmdb.result["biography"] = dhe(biography)
- else:
- bio = dhe(scrapertools.htmlclean(info.strip()))
- actor_tmdb.result["biography"] = dhe(bio)
- except:
- bio = dhe(scrapertools.htmlclean(info.strip()))
- actor_tmdb.result["biography"] = bio
+ actor_tmdb.result["biography"] = bio
else:
actor_tmdb.result["biography"] = config.get_localized_string(60504)
elif not actor_tmdb.result.get("biography"):
- actor_tmdb.result["biography"] = "Sin información"
+ actor_tmdb.result["biography"] = config.get_localized_string(60504)
- #### Compatibilidad con Kodi 18 ####
+ #### Kodi 18 Compatibility ####
if config.get_platform(True)['num_version'] < 18:
self.setCoordinateResolution(2)
-
- self.background = xbmcgui.ControlImage(30, -5, 1250, 730, 'http://imgur.com/7ccBX3g.png')
+
+ self.background = xbmcgui.ControlImage(0, 0, 1280, 720, imagepath('white'), colorDiffuse='FF232323')
self.addControl(self.background)
- if set_animation:
- self.background.setAnimations(
- [('conditional', 'effect=fade start=0% end=100% delay=2000 time=1500 condition=true',),
- ('WindowClose', 'effect=slide end=0,-700% time=1000 condition=true',)])
- self.filmo = xbmcgui.ControlImage(330, 470, 230, 45, 'http://s6.postimg.cc/rlktamqhd/filmography1.png')
- self.addControl(self.filmo)
- if set_animation:
- self.filmo.setAnimations([('conditional',
- 'effect=zoom start=0,700 end=100% center=auto delay=5500 time=1000 condition=true tween=elastic',),
- ('WindowClose', 'effect=zoom start=100% end=0% time=1000 condition=true',)])
- self.title = xbmcgui.ControlTextBox(470, 30, 730, 250)
+ # TITLE
+ self.title = xbmcgui.ControlTextBox(40, 40, 750, 30, font=self.fonts["30"])
self.addControl(self.title)
- if set_animation:
- self.title.setAnimations(
- [('conditional', 'effect=slide start=-1500% end=0% delay=3000 time=1500 condition=true',),
- ('WindowClose', 'effect=slide end=1500% time=1000 condition=true',)])
+ self.title.setAnimations([('WindowOpen', 'effect=slide start=-750,0 end=0,0 delay=100 time=200'), ('WindowClose', 'effect=slide start=0,0 end=-750,0 delay=100 time=200')])
self.title.setText(self.nombre)
- self.info_actor = xbmcgui.ControlTextBox(470, 70, 750, 400)
- self.addControl(self.info_actor)
- if set_animation:
- self.info_actor.setAnimations(
- [('conditional', 'effect=slide start=2000% end=-10% delay=5300 time=1500 tween=bounce condition=true',),
- ('WindowClose', 'effect=slide end=-2000% time=1000 condition=true',)])
- try:
- self.info_actor.autoScroll(7000, 6000, 30000)
- except:
- xbmc.executebuiltin(
- config.get_localized_string(70500))
- self.info_actor.setText(
- "[COLOR coral][B]%s[/B][/COLOR]" % actor_tmdb.result.get("biography", config.get_localized_string(60504)))
- self.titulos = []
- tipo_busqueda = "cast"
- if self.job != "actor":
- tipo_busqueda = "crew"
+ # ACTOR INFO (PLOT)
+ self.info_actor = xbmcgui.ControlTextBox(40, 140, 760, 460, font=self.fonts["24"])
+ self.addControl(self.info_actor)
+ self.info_actor.setAnimations([('WindowOpen', 'effect=slide start=-750,0 end=0,0 delay=100 time=200'), ('WindowClose', 'effect=slide start=0,0 end=-750,0 delay=100 time=200')])
+ try: self.info_actor.autoScroll(10000, 2000, 30000)
+ except: xbmc.executebuiltin( config.get_localized_string(70500))
+ self.info_actor.setText(typo(actor_tmdb.result.get("biography", config.get_localized_string(60504)),'bold'))
+
+ # POSTER
+ self.thumbnail = xbmcgui.ControlImage(880, 40, 400, 600, self.thumbnail)
+ self.addControl(self.thumbnail)
+ self.thumbnail.setAnimations([('WindowOpen', 'effect=slide start=+400,0 end=0,0 delay=100 time=200'), ('WindowClose', 'effect=slide start=0,0 end=+400,0 delay=100 time=200')])
+ xbmc.sleep(300)
+
+ # Movies
+ self.Titles = []
+ search_type = "cast"
+ if self.job != "actor": search_type = "crew"
ids = []
- for entradas in actor_tmdb.result.get("%s_credits" % tipo, {}).get(tipo_busqueda, []):
- if entradas["id"] in ids:
- continue
- else:
+ for entradas in actor_tmdb.result.get("%s_credits" % Type, {}).get(search_type, []):
+ if entradas["id"] not in ids and entradas["poster_path"]:
ids.append(entradas["id"])
- thumb = "https://image.tmdb.org/t/p/original"
- if entradas["poster_path"]:
- thumb += entradas["poster_path"]
- else:
- thumb = "http://s6.postimg.cc/tw1vhymj5/noposter.png"
- if self.item.contentType == "movie":
- self.titulos.append([entradas["id"], entradas.get("title", entradas.get("original_title", "")), thumb])
- else:
- self.titulos.append([entradas["id"], entradas.get("title", entradas.get("original_title", "")), thumb])
+ thumbnail = "https://image.tmdb.org/t/p/original"
+ thumbnail += entradas["poster_path"]
+ if self.item.contentType == "movie": self.Titles.append([entradas["id"], entradas.get("title", entradas.get("original_title", "")), thumbnail])
+ else: self.Titles.append([entradas["id"], entradas.get("title", entradas.get("original_title", "")), thumbnail])
self.dialog.update(40, config.get_localized_string(60505))
- self.mas_pelis = 8
+ self.max_movies = max_poster
self.idps = []
- self.botones = []
- self.botones_maspelis = []
- self.focus = -1
+ self.buttons = []
+ self.max_movies_buttons = []
+ self.focus = 0
i = 0
count = 0
- self.btn_left = xbmcgui.ControlButton(90, 490, 70, 29, '', "http://s6.postimg.cc/i3pnobu6p/redarrow.png",
- "http://s6.postimg.cc/i3pnobu6p/redarrow.png")
+ self.btn_left = xbmcgui.ControlButton(0, 680, 40, 40, '', imagepath('previous_focus'), imagepath('previous_no_focus'))
self.addControl(self.btn_left)
- if set_animation:
- self.btn_left.setAnimations([('conditional',
- 'effect=zoom start=720,642,70,29 end=640,642,69,29 time=1000 loop=true tween=bounce condition=Control.HasFocus(' + str(
- self.btn_left.getId()) + ')',),
- ('WindowClose', 'effect=fade end=0% time=1000 condition=true',)])
- self.btn_left.setVisible(False)
- self.botones.append(self.btn_left)
- for idp, peli, foto in self.titulos:
- if count % 8 == 0:
- i = 0
- self.image = xbmcgui.ControlButton(65 + i, 538, 135, 160, '', foto, foto)
- self.neon = xbmcgui.ControlImage(60 + i, 525, 145, 186, "http://s6.postimg.cc/x0jspnxch/buttons.png")
- fadelabel = xbmcgui.ControlFadeLabel(67 + i, 698, 135, 50)
- self.botones.append(self.image)
-
- if count < 8:
+ self.buttons.append(self.btn_left)
+ for idp, title, photo in self.Titles:
+ if count % max_poster == 0: i = 0
+ self.image = xbmcgui.ControlButton(40 + i, 420 + 260, 200, 300, '', photo, photo)
+ self.buttons.append(self.image)
+ if count < max_poster:
self.addControl(self.image)
- if set_animation:
- self.image.setAnimations([('conditional',
- 'effect=rotatey start=200 end=0 delay=2000 time=900 tween=elastic condition=true',),
- ('unfocus',
- 'effect=zoom center=auto start=70% end=100% time=700 reversible=false',), (
- 'focus',
- 'effect=rotate center=auto start=0% end=360% time=650 tween=bounce',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',), ])
- self.addControl(self.neon)
- self.neon.setVisibleCondition('[Control.HasFocus(' + str(self.image.getId()) + ')]')
- if set_animation:
- self.neon.setAnimations([('conditional',
- 'effect=rotate center=auto start=0% end=360% time=650 tween=bounce condition=Control.HasFocus(' + str(
- self.image.getId()) + ')',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',), ])
-
- self.addControl(fadelabel)
- fadelabel.addLabel(peli)
- if set_animation:
- fadelabel.setAnimations([('conditional',
- 'effect=rotatey start=200 end=0 delay=6200 time=900 tween=elastic condition=true',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',)])
-
- self.idps.append([self.image, peli, idp, foto])
- self.botones_maspelis.append([self.image, self.neon, fadelabel, peli])
-
- i += 150
+ self.image.setAnimations([('focus', 'effect=slide start=0,0 end=0,-260 time=200'),('unfocus', 'effect=slide start=-0,-260 end=0,0 time=200'),('WindowOpen', 'effect=slide start=0,40 end=0,0 delay=100 time=200 conditional=true'),('WindowClose', 'effect=slide start=0,0 end=0,40 delay=100 time=200 conditional=true')])
+ self.idps.append([self.image, title, idp, photo])
+ self.max_movies_buttons.append([self.image, title])
+ i += 200
count += 1
xbmc.sleep(200)
- if len(self.titulos) > 8:
- self.btn_right = xbmcgui.ControlButton(1150, 495, 60, 27, '',
- "http://s6.postimg.cc/j4uhr70k1/greenarrow.png",
- "http://s6.postimg.cc/j4uhr70k1/greenarrow.png")
- self.addControl(self.btn_right)
- if set_animation:
- self.btn_right.setAnimations(
- [('conditional', 'effect=slide start=-3000 end=0 delay=5000 time=2000 condition=true tween=bounce',), (
- 'conditional',
- 'effect=zoom start=230,490, 60, 27, 29 end=1230,642,61,27 time=1000 loop=true tween=bounce condition=Control.HasFocus(' + str(
- self.btn_right.getId()) + ')',),
- ('WindowClose', 'effect=fade end=0% time=1000 condition=true',)])
- self.botones.append(self.btn_right)
+ self.btn_right = xbmcgui.ControlButton(1240, 680, 40, 40, '', imagepath('next_focus'), imagepath('next_no_focus'))
+ self.addControl(self.btn_right)
+ self.buttons.append(self.btn_right)
xbmc.sleep(200)
- self.dialog.update(80, config.get_localized_string(60506))
- self.images = []
- for images in actor_tmdb.result.get("images", {}).get("profiles", []):
- imagen = "https://image.tmdb.org/t/p/original" + images["file_path"]
- self.images.append(imagen)
-
- if len(self.images) <= 1 or (len(self.images) == 2 and self.images[0] == self.images[1]):
- self.marco = xbmcgui.ControlImage(100, 23, 330, 425,
- 'http://s6.postimg.cc/nkmk7b8nl/marco_foto2_copia.png')
- self.addControl(self.marco)
- if set_animation:
- self.marco.setAnimations(
- [('conditional', 'effect=rotatey start=100% end=0% delay=2400 time=1500 condition=true',),
- ('WindowClose', 'effect=fade end=0% time=1000 condition=true',)])
- self.thumb = xbmcgui.ControlImage(115, 40, 294, 397, self.thumbnail)
- self.addControl(self.thumb)
- if set_animation:
- self.thumb.setAnimations(
- [('conditional', 'effect=rotatey start=100% end=0% delay=2380 time=1500 condition=true',),
- ('WindowClose', 'effect=fade end=0% time=1000 condition=true',)])
- xbmc.sleep(300)
- else:
- self.start_change = False
- self.th = Thread(target=self.change_image)
- self.th.setDaemon(True)
- self.th.start()
-
self.dialog.close()
- def change_image(self):
- global exit_loop
- imagenes = []
- while True:
- xbmc.sleep(100)
- for i, image in enumerate(self.images):
- xbmc.sleep(400)
- if i == 0:
- xbmc.sleep(300)
- self.marco = xbmcgui.ControlImage(100, 23, 330, 425,
- 'http://s6.postimg.cc/nkmk7b8nl/marco_foto2_copia.png')
- self.thumb = xbmcgui.ControlImage(115, 40, 294, 397, "")
- xbmc.sleep(500)
- self.addControl(self.marco)
- if set_animation:
- self.marco.setAnimations(
- [('conditional', 'effect=rotatey start=100% end=0% delay=2300 time=1500 condition=true',),
- ('WindowClose', 'effect=fade end=0% time=1000 condition=true',)])
- self.addControl(self.thumb)
- self.thumb.setImage(self.thumbnail)
- if set_animation:
- self.thumb.setAnimations(
- [('conditional', 'effect=rotatey start=100% end=0% delay=2280 time=1500 condition=true',),
- ('WindowClose', 'effect=fade end=0% time=1000 condition=true',)])
- xbmc.sleep(4000)
- for img in imagenes:
- self.removeControls([img[0], img[1]])
- imagenes = []
- imagenes.append([self.thumb, self.marco])
- if exit_loop:
- break
-
- if exit_loop:
- break
- if i > 0:
- if exit_loop:
- break
- xbmc.sleep(5200)
- self.marco = xbmcgui.ControlImage(100, 23, 330, 425,
- 'http://s6.postimg.cc/4syg4krkh/marco_foto.png')
- self.addControl(self.marco)
- if set_animation:
- self.marco.setAnimations(
- [('conditional', 'effect=rotatey start=100% end=0% delay=300 time=1500 condition=true',),
- ('WindowClose', 'effect=fade end=0% time=1000 condition=true',)])
- self.thumb = xbmcgui.ControlImage(115, 40, 294, 397, "")
- self.addControl(self.thumb)
- self.thumb.setImage(image, True)
- if set_animation:
- self.thumb.setAnimations(
- [('conditional', 'effect=rotatey start=100% end=0% delay=285 time=1500 condition=true',),
- ('WindowClose', 'effect=fade end=0% time=1000 condition=true',)])
- imagenes.append([self.thumb, self.marco])
-
- xbmc.sleep(400)
- if exit_loop:
- break
- logger.log("salimos carajo xD")
def onAction(self, action):
global exit_loop
if exit_loop:
exit_loop = False
- if action == ACTION_MOVE_RIGHT or action == ACTION_MOVE_DOWN:
- if self.focus < len(self.botones) - 1:
- self.focus += 1
- while True:
- id_focus = str(self.botones[self.focus].getId())
- if xbmc.getCondVisibility('[Control.IsVisible(' + id_focus + ')]'):
- self.setFocus(self.botones[self.focus])
- break
+ if action == ACTION_MOVE_RIGHT:
+ if self.getFocusId() not in [3012]:
+ if self.focus < len(self.buttons) - 1:
self.focus += 1
- if self.focus == len(self.botones):
- break
+ while True:
+ id_focus = str(self.buttons[self.focus].getId())
+ if xbmc.getCondVisibility('[Control.IsVisible(' + id_focus + ')]'):
+ self.setFocus(self.buttons[self.focus])
+ break
+ self.focus += 1
+ if self.focus == len(self.buttons):
+ break
+ elif self.getFocusId() in [3012]:
+ self.focus = 0
+ self.setFocus(self.btn_left)
- if action == ACTION_MOVE_LEFT or action == ACTION_MOVE_UP:
- if self.focus > 0:
- self.focus -= 1
- while True:
- id_focus = str(self.botones[self.focus].getId())
- if xbmc.getCondVisibility('[Control.IsVisible(' + id_focus + ')]'):
- self.setFocus(self.botones[self.focus])
- break
+ if action == ACTION_MOVE_LEFT:
+ if self.getFocusId() not in [3005]:
+ if self.focus > 0:
self.focus -= 1
- if self.focus == len(self.botones):
- break
+ while True:
+ id_focus = str(self.buttons[self.focus].getId())
+ if xbmc.getCondVisibility('[Control.IsVisible(' + id_focus + ')]'):
+ self.setFocus(self.buttons[self.focus])
+ break
+ self.focus -= 1
+ if self.focus == len(self.buttons):
+ break
+ elif self.getFocusId() in [3005]:
+ self.focus = len(self.buttons) - 1
+ self.setFocus(self.btn_right)
if action == ACTION_PREVIOUS_MENU or action == ACTION_GESTURE_SWIPE_LEFT or action == 110 or action == 92:
exit_loop = True
self.close()
if action == 105 or action == 6:
- for boton, peli, id, poster2 in self.idps:
+ for button, title, id, poster in self.idps:
try:
- if self.getFocusId() == boton.getId() and self.btn_right:
- self.focus = len(self.botones) - 1
+ if self.getFocusId() == button.getId() and self.btn_right:
+ self.focus = len(self.buttons) - 1
xbmc.executebuiltin('SendClick(%s)' % self.btn_right.getId())
except:
pass
if action == 104 or action == 5:
- for boton, peli, id, poster2 in self.idps:
+ for button, title, id, poster in self.idps:
try:
- if self.getFocusId() == boton.getId() and self.btn_left:
+ if self.getFocusId() == button.getId() and self.btn_left:
self.setFocus(self.btn_left)
xbmc.executebuiltin('SendClick(%s)' % self.btn_left.getId())
except:
pass
def onControl(self, control):
- try:
- if control == self.btn_right:
+ if control == self.btn_right:
+ try:
i = 1
count = 0
- for afoto, neon, fadelabel, peli in self.botones_maspelis:
- if i > self.mas_pelis - 8 and i <= self.mas_pelis and count < 8:
- self.removeControls([afoto, neon, fadelabel])
+ for photo, title in self.max_movies_buttons:
+ if i > self.max_movies - max_poster and i <= self.max_movies and count < max_poster:
+ self.removeControls([photo])
count += 1
- elif i > self.mas_pelis and count < 16:
- self.addControl(afoto)
- if set_animation:
- afoto.setAnimations([('conditional',
- 'effect=rotatey start=200 end=0 time=900 delay=200 tween=elastic condition=true',),
- ('unfocus',
- 'effect=zoom center=auto start=70% end=100% time=700 reversible=false',),
- ('focus',
- 'effect=rotate center=auto start=0% end=360% time=650 tween=bounce',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',), ])
- self.addControl(neon)
- neon.setVisibleCondition('[Control.HasFocus(' + str(afoto.getId()) + ')]')
- if set_animation:
- neon.setAnimations([('conditional',
- 'effect=rotate center=auto start=0% end=360% time=650 tween=bounce condition=Control.HasFocus(' + str(
- afoto.getId()) + ')',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',), ])
- self.addControl(fadelabel)
- fadelabel.addLabel(peli)
- if set_animation:
- fadelabel.setAnimations(
- [('conditional', 'effect=rotatey start=200 end=0 time=900 tween=elastic condition=true',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',)])
-
+ elif i > self.max_movies and count < max_poster * 2:
+ self.addControl(photo)
+ photo.setAnimations([('focus', 'effect=slide start=0,0 end=0,-260 time=200'),('unfocus', 'effect=slide start=-0,-260 end=0,0 time=200'),('WindowOpen', 'effect=slide start=0,40 end=0,0 delay=100 time=200 conditional=true'),('WindowClose', 'effect=slide start=0,0 end=0,40 delay=100 time=200 conditional=true')])
count += 1
- self.mas_pelis += 1
+ self.max_movies += 1
xbmc.sleep(120)
i += 1
-
- if self.mas_pelis > 8 and self.mas_pelis < 17:
- self.btn_left.setVisible(True)
-
- if len(self.botones_maspelis) < self.mas_pelis + 1:
- self.btn_right.setVisible(False)
- self.btn_right.setVisible(False)
- self.setFocus(self.btn_left)
- self.focus = 4
- else:
- self.focus = len(self.botones) - 1
- self.setFocus(self.btn_right)
-
xbmc.sleep(300)
- except:
- pass
- try:
- if control == self.btn_left:
+ except:
+ pass
+ elif control == self.btn_left:
+ try:
i = 1
count = 0
- if self.mas_pelis == len(self.botones_maspelis):
- self.btn_right.setVisible(True)
- len_pelis = self.mas_pelis
- for afoto, neon, fadelabel, peli in self.botones_maspelis:
- resta = 8 + (len_pelis % 8)
- if resta == 8:
- resta = 16
- resta2 = len_pelis % 8
- if not resta2:
- resta2 = 8
- if i > len_pelis - resta and count < 8:
- self.addControl(afoto)
- if set_animation:
- afoto.setAnimations(
- [('conditional', 'effect=rotatey start=200 end=0 time=900 tween=elastic condition=true',),
- ('unfocus', 'effect=zoom center=auto start=70% end=100% time=700 reversible=false',),
- ('focus', 'effect=rotate center=auto start=0% end=360% time=650 tween=bounce',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',), ])
- self.addControl(neon)
- neon.setVisibleCondition('[Control.HasFocus(' + str(afoto.getId()) + ')]')
- if set_animation:
- neon.setAnimations([('conditional',
- 'effect=rotate center=auto start=0% end=360% time=650 tween=bounce condition=Control.HasFocus(' + str(
- afoto.getId()) + ')',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',), ])
- self.addControl(fadelabel)
- fadelabel.addLabel(peli)
- if set_animation:
- fadelabel.setAnimations(
- [('conditional', 'effect=rotatey start=200 end=0 time=900 tween=elastic condition=true',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',)])
+ for photo, title in self.max_movies_buttons:
+ stay = max_poster + (self.max_movies % max_poster)
+ if stay == max_poster:
+ stay = max_poster * 2
+ stay2 = self.max_movies % max_poster
+ if not stay2:
+ stay2 = max_poster
+ if i > self.max_movies - stay and count < max_poster:
+ self.addControl(photo)
+ photo.setAnimations([('focus', 'effect=slide start=0,0 end=0,-260 time=200'),('unfocus', 'effect=slide start=-0,-260 end=0,0 time=200'),('WindowOpen', 'effect=slide start=0,40 end=0,0 delay=100 time=200 conditional=true'),('WindowClose', 'effect=slide start=0,0 end=0,40 delay=100 time=200 conditional=true')])
count += 1
- elif i > len_pelis - resta2 and i <= len_pelis and count < 16:
- self.removeControls([afoto, neon, fadelabel])
+ elif i > self.max_movies - stay2 and i <= self.max_movies and count < max_poster * 2:
+ self.removeControls([photo])
count += 1
- self.mas_pelis -= 1
+ self.max_movies -= 1
i += 1
-
- if self.mas_pelis == 8:
+ if self.max_movies == max_poster:
self.btn_left.setVisible(False)
- except:
- pass
+ except:
+ pass
- for boton, peli, id, poster2 in self.idps:
- if control == boton:
- dialog = platformtools.dialog_progress(config.get_localized_string(60486),
- config.get_localized_string(60487))
- tipo = self.item.contentType
- if tipo != "movie":
- tipo = "tv"
- new_tmdb = tmdb.Tmdb(id_Tmdb=id, tipo=tipo)
- new_infolabels = new_tmdb.get_infoLabels()
-
- new_infolabels["cast"] = new_tmdb.result.get("credits_cast", [])
- new_infolabels["crew"] = new_tmdb.result.get("credits_crew", [])
- new_infolabels["created_by"] = new_tmdb.result.get("created_by", [])
- global relatedWindow
- relatedWindow = related(item=self.item, infolabels=new_infolabels, fonts=self.fonts, dialog=dialog)
- relatedWindow.doModal()
+ else:
+ for button, title, id, poster in self.idps:
+ if control == button:
+ new_item = self.item.clone(title=title,infoLabels={'tmdb_id':id})
+ self.close()
+ start(new_item, from_window=True)
class images(xbmcgui.WindowDialog):
def __init__(self, *args, **kwargs):
- self.fanartv = kwargs.get("fanartv", {})
self.tmdb = kwargs.get("tmdb", {})
- self.imdb = kwargs.get("imdb", [])
- self.fa = kwargs.get("fa", [])
- self.mal = kwargs.get("mal", [])
- self.imagenes = []
+ self.image_list = []
+
for key, value in self.tmdb.items():
- for detail in value:
- self.imagenes.append('http://image.tmdb.org/t/p/w342' + detail["file_path"])
- for tipo, child in self.fanartv.items():
- for imagen in child:
- self.imagenes.append(imagen["url"].replace("/fanart/", "/preview/"))
- for imagen, title in self.fa:
- self.imagenes.append(imagen)
- for imagen in self.imdb:
- self.imagenes.append(imagen["src"])
- for imagen, title in self.mal:
- self.imagenes.append(imagen)
+ for detail in value: self.image_list.append('http://image.tmdb.org/t/p/original' + detail["file_path"])
+ # for image in self.imdb: self.image_list.append(image["src"])
+ # for image, title in self.mal: self.image_list.append(image)
- #### Compatibilidad con Kodi 18 ####
- if config.get_platform(True)['num_version'] < 18:
- self.setCoordinateResolution(2)
-
- self.shadow = xbmcgui.ControlImage(245, 10, 1011, 700, 'http://imgur.com/66VSLTo.png')
- self.addControl(self.shadow)
- if set_animation:
- self.shadow.setAnimations(
- [('conditional', 'effect=slide start=1000% delay=672 time=2500 condition=true',),
- ('WindowClose', 'effect=slide end=0 time=1000 condition=true',)])
- imagen_inicial = self.imagenes[0].replace("/preview/", "/fanart/").replace("-s200", "-large").replace("/w342/",
- "/original/")
- self.background = xbmcgui.ControlImage(248, 17, 1003, 560, imagen_inicial, 2)
+ #### Kodi 18 Compatibility ####
+ if config.get_platform(True)['num_version'] < 18: self.setCoordinateResolution(2)
+
+ self.background = xbmcgui.ControlImage(0, 0, 1280, 720, imagepath('white'), colorDiffuse='CC232323')
self.addControl(self.background)
- if set_animation:
- self.background.setAnimations(
- [('conditional', 'effect=slide start=1000% delay=670 time=2500 condition=true',),
- ('WindowClose', 'effect=slide end=0 time=1000 condition=true',)])
+ main_image = self.image_list[0] if self.image_list else ''
+ self.main_image = xbmcgui.ControlImage(0, 0, 1280, 720, main_image, 2)
+ self.addControl(self.main_image)
- self.botones = []
- self.imgcount = 8
- self.urls = []
- self.botones_imgs = []
- self.focus = -1
- i = 0
- count = 0
- self.btn_left = xbmcgui.ControlButton(293, 550, 70, 29, '', "http://s6.postimg.cc/i3pnobu6p/redarrow.png",
- "http://s6.postimg.cc/i3pnobu6p/redarrow.png")
+ # BUTTON LEFT
+ self.btn_left = xbmcgui.ControlButton(0, 300, 60, 60, '', imagepath('previous_focus'), imagepath('previous_no_focus'))
self.addControl(self.btn_left)
- if set_animation:
- self.btn_left.setAnimations(
- [('conditional', 'effect=zoom start=-100 end=100 delay=5000 time=2000 condition=true tween=bounce',), (
- 'conditional',
- 'effect=zoom start=293,642,70,29 end=243,642,69,29 time=1000 loop=true tween=bounce condition=Control.HasFocus(' + str(
- self.btn_left.getId()) + ')',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',)])
- self.btn_left.setVisible(False)
- self.botones.append(self.btn_left)
- for img in self.imagenes:
- img = img.replace(" ", "%20")
- if count % 8 == 0:
- i = 0
- self.image = xbmcgui.ControlButton(280 + i, 590, 100, 98, '', img, img)
- self.neon = xbmcgui.ControlImage(280 + i, 590, 100, 98, "http://s6.postimg.cc/x0jspnxch/buttons.png")
- self.botones.append(self.image)
- if count < 8:
- self.addControl(self.image)
- if set_animation:
- self.image.setAnimations([('conditional',
- 'effect=rotatey start=200 end=0 delay=3500 time=900 tween=elastic condition=true',),
- ('unfocus',
- 'effect=zoom center=auto start=70% end=100% time=700 reversible=false',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',)])
- self.addControl(self.neon)
- self.neon.setVisibleCondition('[Control.HasFocus(' + str(self.image.getId()) + ')]')
- if set_animation:
- self.neon.setAnimations([('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',)])
+ self.btn_left.setAnimations([('WindowOpen', 'effect=slide start=-60,0 end=0,0 delay=100 time=200'),('WindowClose', 'effect=slide start=0,0 end=-60,0 delay=100 time=200')])
- self.urls.append([self.image, img])
- self.botones_imgs.append([self.image, self.neon])
+ # BUTTON RIGHT
+ self.btn_right = xbmcgui.ControlButton(1220, 300, 60, 60, '', imagepath('next_focus'), imagepath('next_no_focus'))
+ self.addControl(self.btn_right)
+ self.btn_right.setAnimations([('WindowOpen', 'effect=slide start=60,0 end=0,0 delay=100 time=200'),('WindowClose', 'effect=slide start=0,0 end=60,0 delay=100 time=200')])
- i += 120
- count += 1
- xbmc.sleep(200)
- if len(self.imagenes) > 8:
- self.btn_right = xbmcgui.ControlButton(1150, 550, 60, 27, '',
- "http://s6.postimg.cc/j4uhr70k1/greenarrow.png",
- "http://s6.postimg.cc/j4uhr70k1/greenarrow.png")
- self.addControl(self.btn_right)
- if set_animation:
- self.btn_right.setAnimations(
- [('conditional', 'effect=slide start=-3000 end=0 delay=3600 time=2000 condition=true tween=bounce',), (
- 'conditional',
- 'effect=zoom start=230,490, 60, 27, 29 end=1190,642,61,27 time=1000 loop=true tween=bounce condition=Control.HasFocus(' + str(
- self.btn_right.getId()) + ')',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',)])
- self.botones.append(self.btn_right)
- xbmc.sleep(200)
+ self.count = 0
def onAction(self, action):
if action == ACTION_PREVIOUS_MENU or action == ACTION_GESTURE_SWIPE_LEFT or action == 110 or action == 92:
self.close()
if action == ACTION_MOVE_RIGHT or action == ACTION_MOVE_DOWN:
- if self.focus < len(self.botones) - 1:
- self.focus += 1
- while True:
- id_focus = str(self.botones[self.focus].getId())
- if xbmc.getCondVisibility('[Control.IsVisible(' + id_focus + ')]'):
- self.setFocus(self.botones[self.focus])
- break
- self.focus += 1
- if self.focus == len(self.botones):
- break
+ self.count += 1
+ if self.count > len(self.image_list) -1: self.count = 0
+ self.main_image.setImage(self.image_list[self.count])
if action == ACTION_MOVE_LEFT or action == ACTION_MOVE_UP:
- if self.focus > 0:
- self.focus -= 1
- while True:
- id_focus = str(self.botones[self.focus].getId())
- if xbmc.getCondVisibility('[Control.IsVisible(' + id_focus + ')]'):
- self.setFocus(self.botones[self.focus])
- break
- self.focus -= 1
- if self.focus == len(self.botones):
- break
+ self.count -= 1
+ if self.count < 0: self.count = len(self.image_list) -1
+ self.main_image.setImage(self.image_list[self.count])
- if action == 105 or action == 6:
- for image, neon in self.botones_imgs:
- try:
- if self.getFocusId() == image.getId() and self.btn_right:
- self.focus = len(self.botones) - 1
- xbmc.executebuiltin('SendClick(%s)' % self.btn_right.getId())
- except:
- pass
-
- if action == 104 or action == 5:
- for image, neon in self.botones_imgs:
- try:
- if self.getFocusId() == image.getId() and self.btn_left:
- self.focus = 0
- xbmc.executebuiltin('SendClick(%s)' % self.btn_left.getId())
- except:
- pass
def onControl(self, control):
- try:
- if control == self.btn_right:
- i = 1
- count = 0
- for image, neon in self.botones_imgs:
- if i > self.imgcount - 8 and i <= self.imgcount and count < 8:
- self.removeControls([image, neon])
- count += 1
- elif i > self.imgcount and count < 16:
- self.addControl(image)
- if set_animation:
- image.setAnimations([('conditional',
- 'effect=rotatey start=200 end=0 delay=600 time=900 tween=elastic condition=true',),
- ('unfocus',
- 'effect=zoom center=auto start=70% end=100% time=700 reversible=false',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',)])
- self.addControl(neon)
- neon.setVisibleCondition('[Control.HasFocus(' + str(image.getId()) + ')]')
- if set_animation:
- neon.setAnimations([('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',)])
+ if control == self.btn_right:
+ self.count += 1
+ if self.count > len(self.image_list) -1: self.count = 0
+ self.main_image.setImage(self.image_list[self.count])
- count += 1
- self.imgcount += 1
- xbmc.sleep(120)
- i += 1
-
- if self.imgcount > 8 and self.imgcount < 17:
- self.btn_left.setVisible(True)
-
- if len(self.botones_imgs) < self.imgcount + 1:
- self.btn_right.setVisible(False)
-
- self.focus = -1
- xbmc.executebuiltin('Action(Right)')
- xbmc.sleep(300)
- except:
- pass
-
- try:
- if control == self.btn_left:
- i = 1
- count = 0
- if self.imgcount == len(self.botones_imgs):
- self.btn_right.setVisible(True)
-
- len_images = self.imgcount
- for image, neon in self.botones_imgs:
- resta = 8 + (len_images % 8)
- if resta == 8:
- resta = 16
- resta2 = len_images % 8
- if not resta2:
- resta2 = 8
- if i > len_images - resta and count < 8:
- self.addControl(image)
- if set_animation:
- image.setAnimations([('conditional',
- 'effect=rotatey start=200 end=0 delay=600 time=900 tween=elastic condition=true',),
- ('unfocus',
- 'effect=zoom center=auto start=70% end=100% time=700 reversible=false',),
- ('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',)])
- self.addControl(neon)
- neon.setVisibleCondition('[Control.HasFocus(' + str(image.getId()) + ')]')
- if set_animation:
- neon.setAnimations([('WindowClose', 'effect=slide end=0,700% time=1000 condition=true',)])
- count += 1
- elif i > len_images - resta2 and i <= len_images and count < 16:
- self.removeControls([image, neon])
- count += 1
- self.imgcount -= 1
- i += 1
-
- if self.imgcount == 8:
- self.btn_left.setVisible(False)
- self.setFocus(self.botones[1])
- else:
- self.setFocus(self.btn_left)
- except:
- pass
-
- for boton, url in self.urls:
- if control == boton:
- if "fanart.tv" in url:
- url = url.replace("/preview/", "/fanart/")
- elif "filmaffinity" in url:
- url = url.replace("-s200", "-large")
- elif "image.tmdb" in url:
- url = url.replace("/w342/", "/original/")
- self.background.setImage(url.replace(" ", "%20"))
+ if control == self.btn_left:
+ self.count -= 1
+ if self.count < 0: self.count = len(self.image_list) -1
+ self.main_image.setImage(self.image_list[self.count])
class Trailer(xbmcgui.WindowXMLDialog):
@@ -2212,41 +959,35 @@ class Trailer(xbmcgui.WindowXMLDialog):
self.item = item
from specials import trailertools
self.video_url, self.windows = trailertools.buscartrailer(self.item.clone(), trailers=trailers)
-
self.doModal()
def onInit(self):
- #### Compatibilidad con Kodi 18 ####
- if config.get_platform(True)['num_version'] < 18:
- self.setCoordinateResolution(0)
-
+ #### Kodi 18 Compatibility####
+ if config.get_platform(True)['num_version'] < 18: self.setCoordinateResolution(0)
+
if not self.video_url:
- platformtools.dialog_notification(config.get_localized_string(60507),
- config.get_localized_string(60508), 2)
+ platformtools.dialog_notification(config.get_localized_string(60507), config.get_localized_string(60508), 2)
self.close()
elif self.video_url == "no_video":
self.close()
else:
new_video = False
while True:
- if new_video:
- self.doModal()
+ if new_video: self.doModal()
xlistitem = xbmcgui.ListItem(path=self.video_url, thumbnailImage=self.item.thumbnail)
pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
pl.clear()
pl.add(self.video_url, xlistitem)
self.player = xbmc.Player()
self.player.play(pl, windowed=True)
- while xbmc.Player().isPlaying():
- xbmc.sleep(1000)
+ while xbmc.Player().isPlaying(): xbmc.sleep(1000)
self.close()
self.video_url = None
new_video = True
self.windows[-1].doModal()
try:
self.video_url = self.windows[-1].result
- if not self.video_url:
- break
+ if not self.video_url: break
except:
break
@@ -2255,128 +996,45 @@ class Trailer(xbmcgui.WindowXMLDialog):
self.player.stop()
self.close()
- elif action == ACTION_MOVE_LEFT:
- xbmc.executebuiltin('PlayerControl(Rewind)')
- elif action == ACTION_MOVE_RIGHT:
- xbmc.executebuiltin('PlayerControl(Forward)')
- elif action == ACTION_SELECT_ITEM:
- xbmc.executebuiltin('PlayerControl(Play)')
- elif action == 199 or action == ACTION_SHOW_FULLSCREEN or action == 9:
- xbmc.log("tuprimalafachaaa")
- if action == 13:
- self.close()
-
- def onClick(self, control):
- if control == self.getControl(2):
- self.player.pause()
+ elif action == ACTION_MOVE_LEFT: xbmc.executebuiltin('PlayerControl(Rewind)')
+ elif action == ACTION_MOVE_RIGHT: xbmc.executebuiltin('PlayerControl(Forward)')
+ elif action == ACTION_SELECT_ITEM: xbmc.executebuiltin('PlayerControl(Play)')
+ elif action == 199 or action == ACTION_SHOW_FULLSCREEN or action == 9: xbmc.log("tuprimalafachaaa")
+ if action == 13: self.close()
-def get_recomendations(item, infoLabels, recomendaciones):
- tipo = item.contentType
- if tipo != "movie":
- tipo = "tv"
- search = {'url': '%s/%s/recommendations' % (tipo, infoLabels['tmdb_id']), 'language': def_lang, 'page': 1}
- reco_tmdb = tmdb.Tmdb(discover=search, tipo=tipo, idioma_busqueda="es")
+def get_recomendations(item, infoLabels, recommendations):
+ Type = item.contentType
+ if Type != "movie": Type = "tv"
+ search = {'url': '%s/%s/recommendations' % (Type, infoLabels['tmdb_id']), 'language': def_lang, 'page': 1}
+ reco_tmdb = tmdb.Tmdb(discover=search, tipo=Type, idioma_Search=def_lang)
for i in range(0, len(reco_tmdb.results)):
- titulo = reco_tmdb.results[i].get("title", reco_tmdb.results[i].get("original_title", ""))
- if not titulo:
- titulo = reco_tmdb.results[i].get("name", reco_tmdb.results[i].get("original_name", ""))
+ Title = reco_tmdb.results[i].get("title", reco_tmdb.results[i].get("original_title", ""))
+ if not Title: Title = reco_tmdb.results[i].get("name", reco_tmdb.results[i].get("original_name", ""))
idtmdb = str(reco_tmdb.results[i].get("id"))
thumbnail = reco_tmdb.results[i].get("poster_path", "")
- if thumbnail:
- thumbnail = 'http://image.tmdb.org/t/p/original' + thumbnail
- recomendaciones.append([idtmdb, titulo, thumbnail])
-
-
-def get_filmaf(item, infoLabels):
- title = infoLabels["title"].replace(" ", "+")
- year = str(infoLabels.get("year", ""))
- url = "http://www.filmaffinity.com/es/advsearch.php?stext={0}&stype%5B%5D=title&country=&genre=&fromyear={1}&toyear={1}".format(
- title, year)
- data = httptools.downloadpage(url).data
-
- tipo = "película"
- if item.contentType != "movie":
- tipo = "serie"
- url_filmaf = scrapertools.find_single_match(data, '
\s*
= 5 and float(rating) < 8:
- rating_filma = "[COLOR springgreen][B]%s[/B][/COLOR]" % rating
- elif float(rating) >= 8:
- rating_filma = "[COLOR yellow][B]%s[/B][/COLOR]" % rating
- else:
- rating_filma = "[COLOR crimson][B]%s[/B][/COLOR]" % rating
- except:
- import traceback
- logger.error(traceback.format_exc())
- rating_filma = "[COLOR crimson][B]%s[/B][/COLOR]" % rating
- plot = scrapertools.find_single_match(data, '(.*?)')
- plot = plot.replace("
", "\n")
-
- else:
- rating_filma = "[COLOR crimson][B]N/A[/B][/COLOR]"
- plot = ""
- return rating_filma, plot
-
-
-def fanartv(item, infoLabels, images={}):
- from core import jsontools
- headers = [['Content-Type', 'application/json']]
- id_search = infoLabels.get('tvdb_id')
- if item.contentType != "movie" and not id_search:
- search = {'url': 'tv/%s/external_ids' % infoLabels['tmdb_id'], 'language': def_lang}
- ob_tmdb = tmdb.Tmdb(discover=search, idioma_busqueda=def_lang)
- id_search = ob_tmdb.result.get("tvdb_id")
- elif item.contentType == "movie":
- id_search = infoLabels.get('tmdb_id')
-
- if id_search:
- if item.contentType == "movie":
- url = "http://webservice.fanart.tv/v3/movies/%s?api_key=cab16e262d72fea6a6843d679aa10300" \
- % infoLabels['tmdb_id']
- else:
- url = "http://webservice.fanart.tv/v3/tv/%s?api_key=cab16e262d72fea6a6843d679aa10300" % id_search
- data = jsontools.load(httptools.downloadpage(url, headers=headers).data)
- if data and not "error message" in data:
- for key, value in list(data.items()):
- if key not in ["name", "tmdb_id", "imdb_id", "thetvdb_id"]:
- images[key] = value
- return images
+ if thumbnail: thumbnail = 'http://image.tmdb.org/t/p/original' + thumbnail
+ recommendations.append([idtmdb, Title, thumbnail])
def get_fonts(skin):
data_font = ""
fonts = {}
- if "confluence" in skin or "estuary" in skin or "refocus" in skin:
- fonts = {"10": "font10", "12": "font12", "16": "font16", "24": "font24_title", "30": "font30"}
- elif "aeonmq" in skin:
- fonts = {"10": "font_14", "12": "font_16", "16": "font_20", "24": "font_24", "30": "font_30"}
- elif "madnox" in skin:
- fonts = {"10": "Font_Reg22", "12": "Font_Reg26", "16": "Font_Reg32", "24": "Font_Reg38",
- "30": "Font_ShowcaseMainLabel2_Caps"}
+ if "confluence" in skin or "estuary" in skin or "refocus" in skin: fonts = {"10": "font10", "12": "font12", "16": "font16", "24": "font24_title", "30": "font30"}
+ elif "aeonmq" in skin: fonts = {"10": "font_14", "12": "font_16", "16": "font_20", "24": "font_24", "30": "font_30"}
+ elif "madnox" in skin: fonts = {"10": "Font_Reg22", "12": "Font_Reg26", "16": "Font_Reg32", "24": "Font_Reg38", "30": "Font_ShowcaseMainLabel2_Caps"}
if not fonts:
from core import filetools
try:
data_font = filetools.read(xbmc.translatePath(filetools.join('special://skin/1080i', 'Font.xml')), "r")
except:
- try:
- data_font = filetools.read(xbmc.translatePath(filetools.join('special://skin/720p', 'Font.xml')), "r")
- except:
- pass
+ try: data_font = filetools.read(xbmc.translatePath(filetools.join('special://skin/720p', 'Font.xml')), "r")
+ except: pass
if data_font:
- fuentes = scrapertools.find_multiple_matches(data_font,
- "([^<]+)<\/name>(?:|)\s*[^<]+<\/filename>\s*(\d+)<\/size>")
+ fuentes = scrapertools.find_multiple_matches(data_font, r"([^<]+)<\/name>(?:|)\s*[^<]+<\/filename>\s*(\d+)<\/size>")
sizes = []
try:
for name, size in fuentes:
@@ -2392,8 +1050,7 @@ def get_fonts(skin):
check = True
break
for size, name in sizes:
- if size == 12 and not check:
- fonts["12"] = name.lower()
+ if size == 12 and not check: fonts["12"] = name.lower()
elif size == 16:
fonts["16"] = name.lower()
elif size == 24:
@@ -2412,22 +1069,25 @@ def get_fonts(skin):
return fonts
-def translate(to_translate, to_language="auto", language="auto", i=0, bio=[]):
- '''Return the translation using google translate
- you must shortcut the langage you define (French = fr, English = en, Spanish = es, etc...)
- if you don't define anything it will detect it or use english by default
- Example:
- print(translate("salut tu vas bien?", "en"))
- hello you alright?'''
- import urllib.request, urllib.error, urllib.parse
- agents = {
- 'User-Agent': "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)"}
- before_trans = 'class="t0">'
- to_translate = urllib.parse.quote(to_translate.replace(" ", "+")).replace("%2B", "+")
- link = "http://translate.google.com/m?hl=%s&sl=%s&q=%s" % (to_language, language, to_translate)
- request = urllib.request.Request(link, headers=agents)
- page = urllib.request.urlopen(request).read()
- result = page[page.find(before_trans) + len(before_trans):]
- result = result.split("<")[0]
- result = re.sub(r"d>|nn", "", result)
- bio.append([i, result])
+def imagepath(image):
+ if len(image.split('.')) == 1: image += '.png'
+ path = filetools.join(config.get_runtime_path(), 'resources', 'skins' , 'Default', 'media', 'Infoplus', image)
+ return path
+
+
+def search_type(self, channel=''):
+ if channel:
+ try:
+ channel = self.item.from_channel
+ if not channel: channel = self.item.channel
+ channel_obj = __import__('channels.%s' % channel, None, None, ["channels.%s" % channel])
+ itemlist = channel_obj.search(self.item.clone(channel=channel), self.infoLabels.get("title"))
+ if not itemlist and self.infoLabels.get("originaltitle"): itemlist = channel_obj.search(self.item.clone(), self.infoLabels.get("originaltitle", ""))
+ except:
+ import traceback
+ logger.error(traceback.format_exc())
+ else:
+ itemlist = globalSearch(self.item, self.infoLabels)
+ if len(itemlist) == 0 and self.infoLabels.get("originaltitle"):
+ itemlist = globalSearch(self.item, self.infoLabels, org_title=True)
+ return itemlist
\ No newline at end of file