diff --git a/plugin.video.alfa/channels/pelisplanet.json b/plugin.video.alfa/channels/pelisplanet.json new file mode 100644 index 00000000..98ad2773 --- /dev/null +++ b/plugin.video.alfa/channels/pelisplanet.json @@ -0,0 +1,70 @@ +{ + "id": "pelisplanet", + "name": "PelisPlanet", + "active": true, + "adult": false, + "language": "es", + "fanart": "https://raw.githubusercontent.com/Inter95/tvguia/master/thumbnails/pelisplanetbg.png", + "thumbnail": "https://raw.githubusercontent.com/Inter95/tvguia/master/thumbnails/pelisplanet.png", + "banner": "https://raw.githubusercontent.com/Inter95/tvguia/master/thumbnails/pelisplanetbaner.png", + "version": 1, + "changes": [ + { + "date": "07/06/17", + "description": "Canal Nuevo" + } + ], + "categories": [ + "movie", + "tvshow", + "vos" + ], + "settings": [ + { + "id": "modo_grafico", + "type": "bool", + "label": "Buscar información extra", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "perfil", + "type": "list", + "label": "Perfil de color", + "default": 3, + "enabled": true, + "visible": true, + "lvalues": [ + "Sin color", + "Perfil 3", + "Perfil 2", + "Perfil 1" + ] + }, + { + "id": "orden_episodios", + "type": "bool", + "label": "Mostrar los episodios de las series en orden descendente", + "default": false, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_peliculas", + "type": "bool", + "label": "Incluir en Novedades - Peliculas", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_infantiles", + "type": "bool", + "label": "Incluir en Novedades - Infantiles", + "default": true, + "enabled": true, + "visible": true + } + ] +} diff --git a/plugin.video.alfa/channels/pelisplanet.py b/plugin.video.alfa/channels/pelisplanet.py new file mode 100644 index 00000000..abd8e264 --- /dev/null +++ b/plugin.video.alfa/channels/pelisplanet.py @@ -0,0 +1,275 @@ +# -*- coding: utf-8 -*- + +import re +import sys +import urllib +import urlparse + +from core import config +from core import httptools +from core import logger +from core import scrapertools +from core import servertools +from core.item import Item +from core import channeltools +from core import tmdb + +host = "http://www.pelisplanet.com/" + +headers = [['User-Agent', 'Mozilla/50.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0'], + ['Referer', host]] + +parameters = channeltools.get_channel_parameters('pelisplanet') +fanart_host = parameters['fanart'] +thumbnail_host = parameters['thumbnail'] +color1, color2, color3 = ['0xFFA5F6AF', '0xFF5FDA6D', '0xFF11811E'] + +def mainlist(item): + logger.info() + itemlist = [] + item.url = host + item.text_color = color1 + item.fanart = fanart_host + thumbnail = "https://raw.githubusercontent.com/Inter95/tvguia/master/thumbnails/%s.png" + + itemlist.append(item.clone(title="Novedades", action="peliculas", text_blod=True, + viewcontent='movies', thumbnail=thumbnail % 'novedades', + viewmode="movie_with_plot")) + + itemlist.append(item.clone(title="Estrenos", action="peliculas", text_blod=True, + url=host + 'genero/estrenos/', thumbnail=thumbnail % 'estrenos')) + + itemlist.append(item.clone(title="Géneros", action="generos", text_blod=True, + viewcontent='movies', thumbnail=thumbnail % 'generos', + viewmode="movie_with_plot", url=host + 'generos/')) + + itemlist.append(Item(channel=item.channel, title="Filtrar por Idiomas", + fanart=fanart_host, folder=False, text_color=color3, + text_blod=True, thumbnail=thumbnail % 'idiomas')) + + itemlist.append(item.clone(title="Castellano", action="peliculas", text_blod=True, + viewcontent='movies', thumbnail=thumbnail % 'castellano', + viewmode="movie_with_plot", url=host + 'idioma/castellano/')) + + itemlist.append(item.clone(title="Latino", action="peliculas", text_blod=True, + viewcontent='movies', thumbnail=thumbnail % 'latino', + viewmode="movie_with_plot", url=host + 'idioma/latino/')) + + itemlist.append(item.clone(title="Buscar por Título o Actor", action="search", text_blod=True, + thumbnail=thumbnail % 'busqueda', url=host)) + return itemlist + + +def search(item, texto): + logger.info() + + texto = texto.replace(" ", "+") + item.url = urlparse.urljoin(item.url, "?s={0}".format(texto)) + + try: + return sub_search(item) + + # Se captura la excepción, para no interrumpir al buscador global si un canal falla + except: + import sys + for line in sys.exc_info(): + logger.error("{0}".format(line)) + return [] + + +def sub_search(item): + logger.info() + + itemlist = [] + data = httptools.downloadpage(item.url).data + data = re.sub(r"\n|\r|\t| |
", "", data) + # logger.info(data) + patron = '
.*?\d+') + + if paginacion: + itemlist.append(Item(channel=item.channel, action="sub_search", + title="» Siguiente »", url=paginacion, + thumbnail='https://raw.githubusercontent.com/Inter95/tvguia/master/thumbnails/next.png')) + + tmdb.set_infoLabels(itemlist) + + for item in itemlist: + if item.infoLabels['plot'] == '': + data = httptools.downloadpage(item.url).data + item.fanart = scrapertools.find_single_match( + data, 'meta property="og:image" content="([^"]+)" \/>') + item.plot = scrapertools.find_single_match(data, + 'Castellano\s*

(.+?)') + item.plot = scrapertools.htmlclean(item.plot) + + return itemlist + + +def newest(categoria): + logger.info() + itemlist = [] + item = Item() + try: + if categoria == 'peliculas': + item.url = host + elif categoria == 'infantiles': + item.url = host + "genero/animacion-e-infantil/" + else: + return [] + + itemlist = peliculas(item) + if itemlist[-1].title == "» 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 peliculas(item): + logger.info() + itemlist = [] + + data = httptools.downloadpage(item.url).data + data = re.sub(r"\n|\r|\t|\(.*?\)|\s{2}| ", "", data) + patron_todas = '

(.*?)