def newest(categoria): logger.info() itemlist = [] item = Item() try: if categoria == 'torrent' or categoria == 'peliculas': item.category_new = 'newest' item.channel = channel item.category = channel.capitalize() item.extra = "peliculas" item.url = api + "?sort_by=date_added&page=0" itemlist = listado(item) if ">> Página siguiente" in itemlist[-1].title: itemlist.pop() if categoria == 'torrent': item.extra = "series" item.url = api_serie + "?sort_by=date_added&page=0" itemlist = listado(item) if ">> Página siguiente" in itemlist[-1].title: itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() item.extra = 'estrenos/' try: if categoria == 'peliculas': item.url = host + 'estrenos/pag-1' elif categoria == 'infantiles': item.url = host + 'peliculas/animacion/pag-1' elif categoria == 'documentales': item.url = host + 'documentales/pag-1' item.extra = 'documentales/' itemlist = lista(item) if itemlist[-1].title == 'Siguiente >>>': itemlist.pop() except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist itemlist = filtertools.get_links(itemlist, item, list_language)
def newest(categoria): logger.info("streamondemand.altadefinizione01 newest" + categoria) itemlist = [] item = Item() try: if categoria == "series": item.url = "https://www.dreamsub.it" item.action = "ultimiep" item.extra = "serie" itemlist = ultimiep(item) if itemlist[-1].action == "ultimiep": itemlist.pop() if categoria == "anime": item.url = "https://www.dreamsub.it" item.action = "ultimiep" item.extra = "anime" itemlist = ultimiep(item) if itemlist[-1].action == "ultimiep": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() item.extra = 'Estrenos' try: if categoria == 'peliculas': item.url = host+'/Ordenar/Estreno/?page=1' elif categoria == 'infantiles': item.url = host+'/Categoria/Animacion/?page=1' elif categoria == 'documentales': item.url = host+'/Documentales/?page=1' item.extra = 'documental' itemlist = lista(item) if itemlist[-1].title == 'Siguiente >>>': itemlist.pop() except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(category): logger.info() item = Item() try: if category in ['peliculas', 'torrent']: item.url = host + 'estrenos-de-cine' item.extra = 'movie' itemlist = lista(item) if itemlist[-1].title == 'Siguiente >>>': itemlist.pop() if category == 'torrent': item.url = host + 'series' item.extra = 'serie' itemlist.extend(lista(item)) if itemlist[-1].title == 'Siguiente >>>': itemlist.pop() except: import sys for line in sys.exc_info(): logger.error("%s" % line) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() # categoria='peliculas' try: if categoria == 'peliculas': item.url = host item.extra = 'peliculas' elif categoria == 'infantiles': item.url = host + 'categoria/animacion-e-infantil/' item.extra = 'peliculas' elif categoria == 'terror': item.url = host + 'categoria/terror/' item.extra = 'peliculas' itemlist = todas(item) if itemlist[-1].title == 'Siguiente >>>': itemlist.pop() except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): itemlist = [] item = Item() try: if categoria == 'peliculas': item.url = urlparse.urljoin(__url_base__,"plugins/last_update_links.php?type=movie&offset=0&limit=30") item.extra = "movie" elif categoria == 'infantiles': item.url = urlparse.urljoin(__url_base__, "plugins/last_update_links.php?type=movie&offset=0&limit=30&genre=Animación") item.extra = "movie" elif categoria == 'series': item.url = urlparse.urljoin(__url_base__,"plugins/combined_json.php?&offset=0&limit=30&type=series") item.extra="series_novedades" else: return [] itemlist = listado(item) if itemlist[-1].action == "listado": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): itemlist = [] item = Item() try: if categoria == 'peliculas': item.url = urlparse.urljoin(__url_base__,"plugins/ultimas-peliculas-updated.php") item.extra = "movie" elif categoria == 'infantiles': item.url = urlparse.urljoin(__url_base__, "plugins/ultimas-peliculas-updated.php") item.filtro=("genero","animación") item.extra = "movie" elif categoria == 'series': item.url = urlparse.urljoin(__url_base__,"plugins/ultimos-capitulos-updated.php") item.extra="series_novedades" else: return [] item.action = "listado" itemlist = listado(item) if itemlist[-1].action == "listado": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() item.extra = 'Estrenos' try: if categoria == 'peliculas': item.url = host + '/Ordenar/Estreno/?page=1' elif categoria == 'infantiles': item.url = host + '/Categoria/Animacion/?page=1' elif categoria == 'documentales': item.url = host + '/Documentales/?page=1' item.extra = 'documental' itemlist = lista(item) if itemlist[-1].title == 'Siguiente >>>': itemlist.pop() except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info("streamondemand-pureita.dreamsub newest" + categoria) itemlist = [] item = Item() try: if categoria == "series": item.url = "https://www.dreamsub.tv" item.action = "ultimiep" item.extra = "serie" itemlist = ultimiep(item) if itemlist[-1].action == "ultimiep": itemlist.pop() if categoria == "anime": item.url = "https://www.dreamsub.tv" item.action = "ultimiep" item.extra = "anime" itemlist = ultimiep(item) if itemlist[-1].action == "ultimiep": itemlist.pop() # Continua la ricerca in caso di errore except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): itemlist = [] item = Item() try: if categoria == "film": item.url = "%s/novita-streaming-1/" % host item.action = "peliculas" item.extra = "movie" itemlist = peliculas(item) if itemlist[-1].action == "peliculas": itemlist.pop() elif categoria == "series": item.url = "%s/ultime-serie-tv-streaming/" % host item.action = "latestep" itemlist = latestep(item) if itemlist[-1].action == "series": itemlist.pop() # Continua la ricerca in caso di errore except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() try: if categoria in ['torrent', 'peliculas']: item.url = host + 'torrents' elif categoria == '4k': item.url = host + 'tags/4k' item.extra2 = 'categorias' item.extra = "peliculas" item.channel = channel item.category_new = 'newest' itemlist = listado(item) if ">> Página siguiente" in itemlist[-1].title: itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() item.title = "newest" item.category_new = "newest" item.channel = channel try: if categoria in ['peliculas', 'torrent']: item.url = host + "page/1/" item.extra = "peliculas" item.extra2 = "novedades" item.action = "listado" itemlist.extend(listado(item)) if len(itemlist) > 0 and (">> Página siguiente" in itemlist[-1].title or "Pagina siguiente >>" in itemlist[-1].title): itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: for line in sys.exc_info(): logger.error("{0}".format(line)) logger.error(traceback.format_exc(1)) return [] return itemlist
def newest(categoria): support.info() itemlist = [] item = Item() try: if categoria == "peliculas": item.url = host + "/category/film/" item.action = "peliculas" item.extra = "movie" item.contentType = 'movie' itemlist = peliculas(item) else: item.url = host + "/aggiornamenti-serie-tv/" item.action = "peliculas" item.args = "newest" item.contentType = 'tvshow' itemlist = peliculas(item) # Continua la ricerca in caso di errore except: import sys for line in sys.exc_info(): support.info("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() try: if categoria == "peliculas": item.url = "http://www.inkapelis.com/" item.action = "entradas" item.extra = "Novedades" if categoria == "terror": item.url = "https://www.inkapelis.com/genero/terror/" item.action = "entradas" itemlist = entradas(item) if itemlist[-1].action == "entradas": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() try: item.extra = 'pelilist' if categoria == 'torrent': item.url = host+'peliculas/' itemlist = listado(item) if itemlist[-1].title == ">> Página siguiente": itemlist.pop() item.url = host+'series/' itemlist.extend(listado(item)) if itemlist[-1].title == ">> Página siguiente": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() try: if categoria == 'peliculas': item.url = host + "peliculas-subtituladas/?filtro=estrenos" item.extra = "peliculas" item.channel = channel item.category_new = 'newest' itemlist = listado(item) if len(itemlist) > 0 and ( ">> Página siguiente" in itemlist[-1].title or "Pagina siguiente >>" in itemlist[-1].title): itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() item.extra = 'estrenos/' try: if categoria in ['peliculas','latino']: item.url = host + '/genre/estrenos/' elif categoria == 'infantiles': item.url = host + '/genre/animacion/' elif categoria == 'terror': item.url = host + '/genre/terror/' itemlist = lista(item) if itemlist[-1].title == 'Siguiente >>>': itemlist.pop() except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def check_bookmark(savepath): from channels import favoritos for fichero in filetools.listdir(savepath): # Ficheros antiguos (".txt") if fichero.endswith(".txt"): # Esperamos 0.1 segundos entre ficheros, para que no se solapen los nombres de archivo time.sleep(0.1) # Obtenemos el item desde el .txt canal, titulo, thumbnail, plot, server, url, fulltitle = favoritos.readbookmark( fichero, savepath) item = Item(channel=canal, action="play", url=url, server=server, title=fulltitle, thumbnail=thumbnail, plot=plot, fanart=thumbnail, extra=os.path.join(savepath, fichero), fulltitle=fulltitle, folder=False) # Eliminamos el .txt os.remove(item.extra) item.extra = "" # Guardamos el archivo filename = os.path.join(savepath, str(time.time()) + ".json") filetools.write(filename, item.tojson())
def newest(categoria): logger.info() itemlist = [] item = Item() item.title = "newest" item.category_new = "newest" item.channel = channel try: if categoria in ['deportes']: item.url = host item.extra = "deportes" item.extra2 = "novedades" item.action = "listado" item.channel_sufix = " [Dascer]" itemlist.extend(listado(item)) if ">> Página siguiente" in itemlist[-1].title or "Pagina siguiente >>" in itemlist[-1].title: itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: for line in sys.exc_info(): logger.error("{0}".format(line)) logger.error(traceback.format_exc(1)) return [] return itemlist
def busqueda(item): logger.info() itemlist = [] data = httptools.downloadpage(item.url).data patron = '<div class="poster-media-card">(.*?)(?:<li class="search-results-item media-item">|<footer>)' bloque = scrapertools.find_multiple_matches(data, patron) for match in bloque: patron = 'href="([^"]+)" title="([^"]+)".*?src="([^"]+)".*?' \ '<p class="search-results-main-info">.*?del año (\d+).*?' \ 'p class.*?>(.*?)<' matches = scrapertools.find_multiple_matches(match, patron) for scrapedurl, scrapedtitle, scrapedthumbnail, year, plot in matches: scrapedtitle = scrapedtitle.capitalize() item.infoLabels["year"] = year plot = scrapertools.htmlclean(plot) new_item = Item(channel=item.channel, thumbnail=scrapedthumbnail, plot=plot) if "/serie/" in scrapedurl: new_item.show = scrapedtitle new_item.contentType = 'tvshow' scrapedurl += "/episodios" title = " [Serie]" new_item.action = 'episodios' elif "/pelicula/" in scrapedurl: new_item.action = "findvideos" filter_thumb = scrapedthumbnail.replace( "https://image.tmdb.org/t/p/w200_and_h300_bestv2", "") filter_list = {"poster_path": filter_thumb} filter_list = filter_list.items() #title = " [Película]" new_item.contentType = "movie" new_item.extra = 'media' new_item.contentTitle = scrapedtitle new_item.infoLabels['filtro'] = filter_list else: continue new_item.title = scrapedtitle + " (" + year + ")" new_item.url = scrapedurl itemlist.append(new_item) #itemlist.append(item.clone(action=action, title=title, url=scrapedurl, thumbnail=scrapedthumbnail, # contentTitle=scrapedtitle, fulltitle=scrapedtitle, # plot=plot, show=show, text_color=color2, contentType=contentType)) tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) next_page = scrapertools.find_single_match( data, 'href="([^"]+)"[^>]+>Más resultados') if next_page != "": next_page = urlparse.urljoin(host, next_page) itemlist.append( Item(channel=item.channel, action="busqueda", title=">> Siguiente", url=next_page, thumbnail=item.thumbnail, text_color=color3)) return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() try: if categoria == 'series': item.channel = "playmax" item.extra = "newest" item.url = host + "/catalogo.php?tipo[]=1&ad=2&ordenar=novedades&con_dis=on" item.contentType = "tvshow" itemlist = fichas(item) if itemlist[-1].action == "fichas": itemlist.pop() elif categoria == 'peliculas': item.channel = "playmax" item.extra = "newest" item.url = host + "/catalogo.php?tipo[]=2&ad=2&ordenar=novedades&con_dis=on" item.contentType = "movie" itemlist = fichas(item) if itemlist[-1].action == "fichas": itemlist.pop() elif categoria == 'infantiles': item.channel = "playmax" item.extra = "newest" item.url = host + "/catalogo.php?tipo[]=2&genero[]=60&ad=2&ordenar=novedades&con_dis=on" item.contentType = "movie" itemlist = fichas(item) if itemlist[-1].action == "fichas": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() #categoria='peliculas' try: if categoria == 'peliculas': item.url = host item.extra = 'peliculas' elif categoria == 'infantiles': item.url = host+'categoria/animacion-e-infantil/' item.extra = 'peliculas' itemlist = todas(item) if itemlist[-1].title == 'Siguiente >>>': itemlist.pop() except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): itemlist = [] item = Item() try: if categoria == 'peliculas': item.url = urlparse.urljoin( __url_base__, "plugins/last_update_links.php?type=movie&offset=0&limit=30") item.extra = "movie" elif categoria == 'infantiles': item.url = urlparse.urljoin( __url_base__, "plugins/last_update_links.php?type=movie&offset=0&limit=30&genre=Animación" ) item.extra = "movie" elif categoria == 'series': item.url = urlparse.urljoin( __url_base__, "plugins/combined_json.php?&offset=0&limit=30&type=series") item.extra = "series_novedades" else: return [] itemlist = listado(item) if itemlist[-1].action == "listado": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() item = Item() try: item.url = host item.extra = "novedades" itemlist = recientes(item) # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("%s" % line) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() try: if categoria == "peliculas": item.url = host item.action = "entradas" item.extra = "Novedades" if categoria == "terror": item.url = host + "genero/terror/" item.action = "entradas" if categoria == "castellano": item.url = host + "?anio=&genero=&calidad=&idioma=Castellano&s=" item.extra = "Buscar" item.action = "entradas" if categoria == "latino": item.url = host + "?anio=&genero=&calidad=&idioma=Latino&s=" item.extra = "Buscar" item.action = "entradas" itemlist = entradas(item) if itemlist[-1].action == "entradas": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(): logger.info("[thegroove360.vedohd] newest") item = Item() try: item.url = host item.action = "peliculas" item.extra = "movie" itemlist = peliculas(item) # Continua la ricerca in caso di errore except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): log(categoria) itemlist = [] item = Item() item.url = host item.extra = 'serie' try: if categoria == "series": itemlist = peliculas_tv(item) except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() try: item.channel = "vernovelasonline" item.extra = "newest" item.url = "http://www.ver-novelas-online.com/" item.action = "capitulos_ultimos" itemlist = capitulos_ultimos(item) # Se captura la excepcion, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info('serietvsubita' + " newest" + categoria) itemlist = [] item = Item() item.url = host item.extra = 'serie' try: if categoria == "series": itemlist = peliculas_tv(item) # Continua la ricerca in caso di errore except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() item = Item() try: item.url = host + "?cat=4" item.extra = "novedades" itemlist = listado(item) if itemlist[-1].action == "listado": itemlist.pop() for it in itemlist: it.contentTitle = it.title # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info("pelisalacarta.channels.inkapelis newest") itemlist = [] item = Item() try: if categoria == "peliculas": item.url = "http://www.inkapelis.com/" item.extra = "Novedades" itemlist = entradas(item) if itemlist[-1].action == "entradas": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def check_bookmark(savepath): from channels import favoritos for fichero in filetools.listdir(savepath): # Ficheros antiguos (".txt") if fichero.endswith(".txt"): # Esperamos 0.1 segundos entre ficheros, para que no se solapen los nombres de archivo time.sleep(0.1) # Obtenemos el item desde el .txt canal, titulo, thumbnail, plot, server, url, fulltitle = favoritos.readbookmark(fichero, savepath) item = Item(channel=canal, action="play", url=url, server=server, title=fulltitle, thumbnail=thumbnail, plot=plot, fanart=thumbnail, extra=os.path.join(savepath, fichero), fulltitle=fulltitle, folder=False) # Eliminamos el .txt os.remove(item.extra) item.extra = "" # Guardamos el archivo filename = os.path.join(savepath, str(time.time()) + ".json") filetools.write(filename, item.tojson())
def newest(categoria): logger.info("pelisalacarta.channels.puyasubs newest") item = Item() try: item.url = "http://puya.se/?cat=4" item.extra = "novedades" itemlist = listado(item) if itemlist[-1].action == "listado": itemlist.pop() for it in itemlist: it.contentTitle = it.title # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info("pelisalacarta.channels.verseriesynovelas newest") itemlist = [] item = Item() try: if categoria == 'series': item.channel = "verseriesynovelas" item.extra = "newest" item.url = "http://www.verseriesynovelas.tv/archivos/nuevo" itemlist = novedades(item) if itemlist[-1].action == "novedades": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info("[casacinema.py] newest" + categoria) itemlist = [] item = Item() try: if categoria == "peliculas": item.url = 'http://www.casacinema.video/genere/film' item.extra = "movie" item.action = "peliculas" itemlist = peliculas(item) if itemlist[-1].action == "peliculas": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info() itemlist = [] item = Item() item.extra = 'estrenos/' try: if categoria == 'peliculas': item.url = host+'/category/estrenos/' elif categoria == 'infantiles': item.url = host+'/category/infantil/' itemlist = lista(item) if itemlist[-1].title == 'Siguiente >>>': itemlist.pop() except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info("streamondemand.misterstreaming newest" + categoria) itemlist = [] item = Item() try: if categoria == "peliculas": item.url = "https://misterstreaming.click/category/film/" item.action = "peliculas" item.extra = "movie" itemlist = peliculas(item) if itemlist[-1].action == "peliculas": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info("[italiafilm.py] newest" + categoria) itemlist = [] item = Item() try: if categoria == "peliculas": item.url = "http://www.italia-film.gratis/category/film-streaming-%s/" % date.today().year item.action = "peliculas" item.extra = "movie" itemlist = peliculas(item) if itemlist[-1].action == "peliculas": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): logger.info("[casacinema.py] newest" + categoria) itemlist = [] item = Item() try: if categoria == "film": item.url = host + '/genere/film' item.extra = "movie" item.action = "peliculas" itemlist = peliculas(item) if itemlist[-1].action == "peliculas": itemlist.pop() # Continua la ricerca in caso di errore except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def newest(categoria): itemlist = [] item = Item() try: if categoria == 'peliculas': item.url = urlparse.urljoin(CHANNEL_HOST, "movies/all/") item.extra = "movies" else: return [] itemlist = listado(item) if itemlist[-1].action == "listado": itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist
def listado(item): logger.info() itemlist = [] data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t|\s{2}| ","",data) patron = '<div class="MiniFicha">.*?' patron += '<img src="([^"]+).*?' patron += '<div class="MiniF_TitleSpecial">[^>]+>([^<]+).*?' patron += '<b>Categoria:\s*</b>([^&]+)»\s*([^<]+).*?' patron += '<div class="OpcionesDescargasMini">(.*?)</div>' matches = re.compile(patron,re.DOTALL).findall(data) for thumbnail, title, cat_padres, cat_hijos, opciones in matches: #logger.debug(thumbnail + "\n" + title + "\n" + cat_padres + "\n" + cat_hijos + "\n" + opciones) # Obtenemos el año del titulo y eliminamos lo q sobre patron = '\d{4}$' year = scrapertools.find_single_match(title,patron) if year: title = re.sub(patron, "", title) patron = '\s?-?\s?(line)?\s?-\s?$' title = re.sub(patron, "", title,flags=re.IGNORECASE) # Obtenemos la imagen b por q es mayor thumbnail = HOST + thumbnail[:-5] + 'b' + thumbnail[-4:] # Buscamos opcion de ver online patron = '<a href="http://estrenosly.org/ver-online-([^"]+)' url_ver = scrapertools.find_single_match(opciones, patron) if url_ver: new_item = Item(channel=item.channel, action="findvideos", title=title, thumbnail=thumbnail, url=url_ver, infoLabels={"year":year}, text_color = color1) cat_padres = cat_padres.strip() if cat_padres in ["peliculas-dvdrip", "HDRIP", "cartelera"]: #if item.extra == 'movie': new_item.contentTitle = title new_item.extra = "movie" # Filtramos nombres validos para la calidad patron = ("rip|dvd|screener|hd|ts|Telesync") if re.search(patron,cat_hijos,flags=re.IGNORECASE): new_item.contentQuality = cat_hijos new_item.title = "%s [%s]" % (title, cat_hijos) elif cat_padres == "peliculas-dvdrip": new_item.contentQuality = "DVDRIP" new_item.title = "%s [DVDRIP]" % title elif cat_padres == "HDRIP": new_item.contentQuality = "HDRIP" new_item.title = "%s [HDRIP]" % title elif cat_padres == "series": new_item.contentSerieName = cat_hijos patron = re.compile('(\d+)x(\d+)') matches = patron.findall(title) if len(matches) == 1: new_item.contentSeason = matches[0][0] new_item.contentEpisodeNumber = matches[0][1].zfill(2) new_item.extra = "episodie" else: # matches == [('1', '01'), ('1', '02'), ('1', '03')] new_item.extra = "multi-episodie" else: #Otras categorias q de momento no nos interesan continue ''' Opcionalmente podriamos obtener los enlaces torrent y descargas directas patron = '<a href="http://estrenosli.org/descarga-directa-([^"]+)' new_item.url_descarga = scrapertools.find_single_match(opciones,patron) patron = '<a href="http://estrenosli.org/descargar-torrent-([^"]+).*?' new_item.url_torrent = scrapertools.find_single_match(opciones,patron)''' itemlist.append(new_item) if itemlist: # Obtenemos los datos basicos de todas las peliculas mediante multihilos tmdb.set_infoLabels(itemlist) # Si es necesario añadir paginacion patron = '<div class="sPages">.*?' patron += '<a href="([^"]+)">Siguiente' url_next_page = scrapertools.find_single_match(data,patron) if url_next_page: itemlist.append(Item(channel=item.channel, action="listado", title=">> Página siguiente", thumbnail=thumbnail_host, url=HOST + url_next_page, folder=True, text_color = color3, text_blod=True)) return itemlist
def run(): logger.info("streamondemand-pureita.platformcode.launcher run") # Test if all the required directories are created config.verify_directories_created() # Extract parameters from sys.argv params, fanart, channel_name, title, fulltitle, url, thumbnail, plot, action, server, extra, subtitle, viewmode, category, show, password = ( extract_parameters() ) logger.info( "streamondemand-pureita.platformcode.launcher fanart=%s, channel_name=%s, title=%s, fulltitle=%s, url=%s, thumbnail=%s, plot=%s, action=%s, server=%s, extra=%s, subtitle=%s, category=%s, show=%s, password=%s" % ( fanart, channel_name, title, fulltitle, url, thumbnail, plot, action, server, extra, subtitle, category, show, password, ) ) try: # Accion por defecto - elegir canal if action == "selectchannel": # Borra el fichero de las cookies para evitar problemas con MV # ficherocookies = os.path.join( config.get_data_path(), 'cookies.lwp' ) # if os.path.exists(ficherocookies): # os.remove(ficherocookies) """ if config.get_setting("updatechannels")=="true": try: from core import updater actualizado = updater.updatechannel("channelselector") if actualizado: import xbmcgui advertencia = xbmcgui.Dialog() advertencia.ok("tvalacarta",config.get_localized_string(30064)) except: pass """ import channelselector as plugin plugin.mainlist(params, url, category) # Actualizar version elif action == "update": try: from core import updater updater.update(params) except ImportError: logger.info("streamondemand-pureita.platformcode.launcher Actualizacion automática desactivada") # import channelselector as plugin # plugin.listchannels(params, url, category) if config.get_system_platform() != "xbox": import xbmc xbmc.executebuiltin("Container.Refresh") elif action == "channeltypes": import channelselector as plugin plugin.channeltypes(params, url, category) elif action == "categories": import channelselector as plugin plugin.categories(params, url, category) elif action == "listchannels": import channelselector as plugin plugin.listchannels(params, url, category) # El resto de acciones vienen en el parámetro "action", y el canal en el parámetro "channel" else: """ if action=="mainlist" and config.get_setting("updatechannels")=="true": try: from core import updater actualizado = updater.updatechannel(channel_name) if actualizado: import xbmcgui advertencia = xbmcgui.Dialog() advertencia.ok("plugin",channel_name,config.get_localized_string(30063)) except: pass """ # La acción puede estar en el core, o ser un canal regular. El buscador es un canal especial que está en streamondemand-pureita regular_channel_path = os.path.join(config.get_runtime_path(), "channels", channel_name + ".py") core_channel_path = os.path.join(config.get_runtime_path(), "core", channel_name + ".py") logger.info("streamondemand-pureita.platformcode.launcher regular_channel_path=%s" % regular_channel_path) logger.info("streamondemand-pureita.platformcode.launcher core_channel_path=%s" % core_channel_path) if ( channel_name == "personal" or channel_name == "personal2" or channel_name == "personal3" or channel_name == "personal4" or channel_name == "personal5" ): import channels.personal as channel elif os.path.exists(regular_channel_path): exec "import channels." + channel_name + " as channel" elif os.path.exists(core_channel_path): exec "from core import " + channel_name + " as channel" logger.info( "streamondemand-pureita.platformcode.launcher running channel %s %s" % (channel.__name__, channel.__file__) ) generico = False # Esto lo he puesto asi porque el buscador puede ser generico o normal, esto estará asi hasta que todos los canales sean genericos if category == "Buscador_Generico": generico = True else: try: generico = channel.isGeneric() except: generico = False if not generico: logger.info("streamondemand-pureita.platformcode.launcher xbmc native channel") if action == "strm": from platformcode import xbmctools xbmctools.playstrm(params, url, category) else: exec "channel." + action + "(params, url, category)" else: logger.info("streamondemand-pureita.platformcode.launcher multiplatform channel") from core.item import Item item = Item( channel=channel_name, title=title, fulltitle=fulltitle, url=url, thumbnail=thumbnail, plot=plot, server=server, category=category, extra=extra, subtitle=subtitle, viewmode=viewmode, show=show, password=password, fanart=fanart, ) """ if item.subtitle!="": logger.info("streamondemand-pureita.platformcode.launcher Downloading subtitle file "+item.subtitle) from core import downloadtools ficherosubtitulo = os.path.join( config.get_data_path() , "subtitulo.srt" ) if os.path.exists(ficherosubtitulo): os.remove(ficherosubtitulo) downloadtools.downloadfile(item.subtitle, ficherosubtitulo ) config.set_setting("subtitulo","true") else: logger.info("streamondemand-pureita.platformcode.launcher No subtitle") """ from platformcode import xbmctools if action == "play": logger.info("streamondemand-pureita.platformcode.launcher play") # Si el canal tiene una acción "play" tiene prioridad if hasattr(channel, "play"): logger.info("streamondemand-pureita.platformcode.launcher executing channel 'play' method") itemlist = channel.play(item) if len(itemlist) > 0: item = itemlist[0] xbmctools.play_video( channel=channel_name, server=item.server, url=item.url, category=item.category, title=item.title, thumbnail=item.thumbnail, plot=item.plot, extra=item.extra, subtitle=item.subtitle, video_password=item.password, fulltitle=item.fulltitle, Serie=item.show, ) else: import xbmcgui ventana_error = xbmcgui.Dialog() ok = ventana_error.ok("plugin", "No hay nada para reproducir") else: logger.info( "streamondemand-pureita.platformcode.launcher no channel 'play' method, executing core method" ) xbmctools.play_video( channel=channel_name, server=item.server, url=item.url, category=item.category, title=item.title, thumbnail=item.thumbnail, plot=item.plot, extra=item.extra, subtitle=item.subtitle, video_password=item.password, fulltitle=item.fulltitle, Serie=item.show, ) elif action == "strm_detail" or action == "play_from_library": logger.info("streamondemand-pureita.platformcode.launcher play_from_library") fulltitle = item.show + " " + item.title elegido = Item(url="") logger.info("item.server=#" + item.server + "#") # Ejecuta find_videos, del canal o común try: itemlist = channel.findvideos(item) except: from servers import servertools itemlist = servertools.find_video_items(item) if len(itemlist) > 0: # for item2 in itemlist: # logger.info(item2.title+" "+item2.subtitle) # El usuario elige el mirror opciones = [] for item in itemlist: opciones.append(item.title) import xbmcgui dia = xbmcgui.Dialog() seleccion = dia.select(config.get_localized_string(30163), opciones) elegido = itemlist[seleccion] if seleccion == -1: return else: elegido = item # Ejecuta el método play del canal, si lo hay try: itemlist = channel.play(elegido) item = itemlist[0] except: item = elegido logger.info("Elegido %s (sub %s)" % (item.title, item.subtitle)) from platformcode import xbmctools logger.info("subtitle=" + item.subtitle) xbmctools.play_video( strmfile=True, channel=item.channel, server=item.server, url=item.url, category=item.category, title=item.title, thumbnail=item.thumbnail, plot=item.plot, extra=item.extra, subtitle=item.subtitle, video_password=item.password, fulltitle=fulltitle, ) elif action == "add_pelicula_to_library": logger.info("streamondemand-pureita.platformcode.launcher add_pelicula_to_library") from platformcode import library # Obtiene el listado desde el que se llamó library.savelibrary( titulo=item.fulltitle, url=item.url, thumbnail=item.thumbnail, server=item.server, plot=item.plot, canal=item.channel, category="Cine", Serie=item.show.strip(), verbose=False, accion="play_from_library", pedirnombre=False, subtitle=item.subtitle, ) elif action == "add_serie_to_library": logger.info( "streamondemand-pureita.platformcode.launcher add_serie_to_library, show=#" + item.show + "#" ) from platformcode import library import xbmcgui # Obtiene el listado desde el que se llamó action = item.extra # Esta marca es porque el item tiene algo más aparte en el atributo "extra" if "###" in item.extra: action = item.extra.split("###")[0] item.extra = item.extra.split("###")[1] exec "itemlist = channel." + action + "(item)" # Progreso pDialog = xbmcgui.DialogProgress() ret = pDialog.create("streamondemand-pureita", "Añadiendo episodios...") pDialog.update(0, "Añadiendo episodio...") totalepisodes = len(itemlist) logger.info("[launcher.py] Total Episodios:" + str(totalepisodes)) i = 0 errores = 0 nuevos = 0 for item in itemlist: i = i + 1 pDialog.update(i * 100 / totalepisodes, "Añadiendo episodio...", item.title) logger.info( "streamondemand-pureita.platformcode.launcher add_serie_to_library, title=" + item.title ) if pDialog.iscanceled(): return try: # (titulo="",url="",thumbnail="",server="",plot="",canal="",category="Cine",Serie="",verbose=True,accion="strm",pedirnombre=True): # Añade todos menos el que dice "Añadir esta serie..." o "Descargar esta serie..." if item.action != "add_serie_to_library" and item.action != "download_all_episodes": nuevos = nuevos + library.savelibrary( titulo=item.title, url=item.url, thumbnail=item.thumbnail, server=item.server, plot=item.plot, canal=item.channel, category="Series", Serie=item.show.strip(), verbose=False, accion="play_from_library", pedirnombre=False, subtitle=item.subtitle, extra=item.extra, ) except IOError: import sys for line in sys.exc_info(): logger.error("%s" % line) logger.info( "streamondemand-pureita.platformcode.launcher Error al grabar el archivo " + item.title ) errores = errores + 1 pDialog.close() # Actualizacion de la biblioteca itemlist = [] if errores > 0: itemlist.append( Item( title="ERRORE, la serie NON si è aggiunta alla biblioteca o la fatto in modo incompleto" ) ) logger.info("[launcher.py] No se pudo añadir " + str(errores) + " episodios") else: itemlist.append(Item(title="La serie è stata aggiunta alla biblioteca")) logger.info("[launcher.py] Ningún error al añadir " + str(errores) + " episodios") # FIXME:jesus Comentado porque no funciona bien en todas las versiones de XBMC # library.update(totalepisodes,errores,nuevos) xbmctools.renderItems(itemlist, params, url, category) # Lista con series para actualizar nombre_fichero_config_canal = os.path.join(config.get_library_path(), "series.xml") if not os.path.exists(nombre_fichero_config_canal): nombre_fichero_config_canal = os.path.join(config.get_data_path(), "series.xml") logger.info("nombre_fichero_config_canal=" + nombre_fichero_config_canal) if not os.path.exists(nombre_fichero_config_canal): f = open(nombre_fichero_config_canal, "w") else: f = open(nombre_fichero_config_canal, "r") contenido = f.read() f.close() f = open(nombre_fichero_config_canal, "w") f.write(contenido) from platformcode import library f.write(library.title_to_folder_name(item.show) + "," + item.url + "," + item.channel + "\n") f.close() elif action == "download_all_episodes": download_all_episodes(item, channel) elif action == "search": logger.info("streamondemand-pureita.platformcode.launcher search") import xbmc keyboard = xbmc.Keyboard("") keyboard.doModal() if keyboard.isConfirmed(): tecleado = keyboard.getText() tecleado = tecleado.replace(" ", "+") itemlist = channel.search(item, tecleado) else: itemlist = [] xbmctools.renderItems(itemlist, params, url, category) else: logger.info( "streamondemand-pureita.platformcode.launcher executing channel '" + action + "' method" ) if action != "findvideos": exec "itemlist = channel." + action + "(item)" # for item in itemlist: # logger.info("viemode="+item.viewmode) else: # Intenta ejecutar una posible funcion "findvideos" del canal if hasattr(channel, "findvideos"): exec "itemlist = channel." + action + "(item)" # Si no funciona, lanza el método genérico para detectar vídeos else: logger.info( "streamondemand-pureita.platformcode.launcher no channel 'findvideos' method, executing core method" ) from servers import servertools itemlist = servertools.find_video_items(item) from platformcode import subtitletools subtitletools.saveSubtitleName(item) # Activa el modo biblioteca para todos los canales genéricos, para que se vea el argumento import xbmcplugin import sys handle = sys.argv[1] xbmcplugin.setContent(int(handle), "movies") # Añade los items a la lista de XBMC xbmctools.renderItems(itemlist, params, url, category) except urllib2.URLError, e: import traceback, sys from pprint import pprint exc_type, exc_value, exc_tb = sys.exc_info() lines = traceback.format_exception(exc_type, exc_value, exc_tb) for line in lines: line_splits = line.split("\n") for line_split in line_splits: logger.error(line_split) import xbmcgui ventana_error = xbmcgui.Dialog() # Agarra los errores surgidos localmente enviados por las librerias internas if hasattr(e, "reason"): logger.info("Razon del error, codigo: %d , Razon: %s" % (e.reason[0], e.reason[1])) texto = config.get_localized_string(30050) # "No se puede conectar con el sitio web" ok = ventana_error.ok("plugin", texto) # Agarra los errores con codigo de respuesta del servidor externo solicitado elif hasattr(e, "code"): logger.info("codigo de error HTTP : %d" % e.code) texto = ( config.get_localized_string(30051) % e.code ) # "El sitio web no funciona correctamente (error http %d)" ok = ventana_error.ok("plugin", texto)
def search_cat(item): filters=None # Obtiene de nuevo los tokens auth_token, user_token = getCredentials() post = 'auth_token=%s' % ( qstr(auth_token) ) logger.info(str(item.url)) #busqueda general url="http://api.series.ly/v2/media/browse" post="auth_token="+auth_token if item.extra =="": post=post+"&order=most_viewed" #busquda por tipo if item.url != "" : mediaType=get_constant("mediaType")[item.url] post=post+"&mediaType=%s" % mediaType #busqueda por genero if item.category != "": post=post+"&genre="+item.category else: logger.info("item.extra") logger.info(item.extra) filters=load_json(item.extra) post=post+"&mediaType=%(mediaType)s&genre=%(genre)s&min_year=%(min_year)s&max_year=%(max_year)s&order=%(order)s&limit=%(limit)s" % filters #paginacion if item.plot != "": post=post+"&page="+item.plot plot=int(item.plot)+1 item.plot=str(plot) # Extrae las entradas (carpetas) serieList = load_json(scrapertools.cache_page(url, post)) if "error" in serieList: if serieList["error"]!=0: error_message(serieList["error"]) return [] else: return [] if serieList == None : serieList = [] logger.info("hay %d series" % len(serieList)) itemlist = [] for serieItem in serieList['results']["medias"]: logger.info(str(serieItem)) tipo=get_constant("mediaType")[serieItem["mediaType"]] itemlist.append(generate_item(serieItem, tipo, auth_token)) #Añadimos Pagina Siguiente if len(itemlist)>0: item= Item(channel=__channel__, title="Pagina Siguiente", action="search_cat", category=item.category, url=item.url, plot=item.plot ) if filters is not None: import json item.extra=json.dumps(filters) itemlist.append(item) logger.info(str(itemlist)) return itemlist