def tmdb_trailers(item, tipo="movie"): logger.info() from core.tmdb import Tmdb itemlist = [] tmdb_search = None if item.infoLabels['tmdb_id']: tmdb_search = Tmdb(id_Tmdb=item.infoLabels['tmdb_id'], tipo=tipo, idioma_busqueda='es') elif item.infoLabels['year']: tmdb_search = Tmdb(texto_buscado=item.contentTitle, tipo=tipo, year=item.infoLabels['year']) if tmdb_search: for result in tmdb_search.get_videos(): title = result['name'] + " [" + result['size'] + "p] (" + result['language'].replace("en", "ING") \ .replace("es", "ESP") + ") [tmdb/youtube]" itemlist.append( item.clone(action="play", title=title, url=result['url'], server="youtube")) return itemlist
def tmdb_trailers(item, dialog, tipo="movie"): logger.debug() from core.tmdb import Tmdb itemlist = [] tmdb_search = None if item.infoLabels['tmdb_id']: tmdb_search = Tmdb(id_Tmdb=item.infoLabels['tmdb_id'], tipo=tipo, search_language=def_lang) elif item.infoLabels['year']: tmdb_search = Tmdb(searched_text=item.contentTitle, tipo=tipo, year=item.infoLabels['year']) if tmdb_search: found = False for vid in tmdb_search.get_videos(): if vid['type'].lower() == 'trailer': title = vid['name'] it = del_id(item.clone(action="play", title=title, title2="TMDB(youtube) - " + vid['language'].replace("en", "ING").replace("it", "ITA") + " [" + vid['size'] + "p]", url=vid['url'], server="youtube")) itemlist.append(it) if vid['language'] == def_lang and not found: # play now because lang is correct and TMDB is trusted found = True launcher.run(it) dialog.close() while platformtools.is_playing(): xbmc.sleep(100) return itemlist
def tmdb_trailers(item, tipo="movie"): logger.info("streamondemand.channels.trailertools tmdb_trailers") from core.tmdb import Tmdb itemlist = [] tmdb_search = None if item.infoLabels['tmdb_id']: tmdb_search = Tmdb(id_Tmdb=item.infoLabels['tmdb_id'], tipo=tipo, idioma_busqueda='it') elif item.infoLabels['year']: tmdb_search = Tmdb(texto_buscado=item.contentTitle, tipo=tipo, year=item.infoLabels['year']) if tmdb_search: for result in tmdb_search.get_videos(): title = result['name'] + " [" + result['size'] + "p] (" + result['language'].replace("en", "ING")\ .replace("es", "ESP")+") [tmdb/youtube]" itemlist.append(item.clone(action="play", title=title, url=result['url'], server="youtube")) return itemlist
def search_trailers(item): logger.info() from core.tmdb import Tmdb import xbmcgui, xbmc tipo = 'movie' if item.contentType == 'movie' else 'tv' nombre = item.contentTitle if item.contentType == 'movie' else item.contentSerieName if item.infoLabels['tmdb_id']: tmdb_search = Tmdb(id_Tmdb=item.infoLabels['tmdb_id'], tipo=tipo, idioma_busqueda='es') else: anyo = item.infoLabels['year'] if item.infoLabels['year'] else '-' tmdb_search = Tmdb(texto_buscado=nombre, tipo=tipo, year=anyo, idioma_busqueda='es') opciones = [] resultados = tmdb_search.get_videos() for res in resultados: # ~ logger.debug(res) it = xbmcgui.ListItem(res['name'], '[%sp] (%s)' % (res['size'], res['language'])) if item.thumbnail: it.setArt({'thumb': item.thumbnail}) opciones.append(it) if len(resultados) == 0: platformtools.dialog_ok(nombre, 'No se encuentra ningún tráiler en TMDB') else: while not xbmc.Monitor().abortRequested(): # (while True) ret = xbmcgui.Dialog().select('Tráilers para %s' % nombre, opciones, useDetails=True) if ret == -1: break platformtools.dialog_notification(resultados[ret]['name'], 'Cargando tráiler ...', time=3000, sound=False) from core import servertools if 'youtube' in resultados[ret]['url']: video_urls, puedes, motivo = servertools.resolve_video_urls_for_playing( 'youtube', resultados[ret]['url']) else: video_urls = [] #TODO si no es youtube ... logger.debug(resultados[ret]) if len(video_urls) > 0: # ~ logger.debug(video_urls) xbmc.Player().play( video_urls[-1][1]) # el último es el de más calidad xbmc.sleep(1000) while not xbmc.Monitor().abortRequested() and xbmc.Player( ).isPlaying(): xbmc.sleep(1000) else: platformtools.dialog_notification( resultados[ret]['name'], 'No se puede reproducir el tráiler', time=3000, sound=False) if len(resultados) == 1: break # si sólo hay un vídeo no volver al diálogo de tráilers