diff --git a/plugin.video.alfa/channels/pordede.json b/plugin.video.alfa/channels/pordede.json new file mode 100644 index 00000000..65c0cde2 --- /dev/null +++ b/plugin.video.alfa/channels/pordede.json @@ -0,0 +1,85 @@ +{ + "id": "pordede", + "name": "Pordede", + "active": true, + "adult": false, + "language": ["cast"], + "thumbnail": "pordede.png", + "banner": "pordede.png", + "categories": [ + "movie", + "tvshow" + ], + "settings": [ + { + "id": "pordedeuser", + "type": "text", + "label": "@30014", + "enabled": true, + "visible": true + }, + { + "id": "pordedepassword", + "type": "text", + "hidden": true, + "label": "@30015", + "enabled": "!eq(-1,'')", + "visible": true + }, + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": false, + "enabled": "!eq(-1,'') + !eq(-2,'')", + "visible": true + }, + { + "id": "pordedesortlinks", + "type": "list", + "label": "Ordenar enlaces", + "default": 0, + "enabled": true, + "visible": "!eq(-2,'') + !eq(-3,'')", + "lvalues": [ + "No", + "Por no Reportes", + "Por Idioma", + "Por Calidad", + "Por Idioma y Calidad", + "Por Idioma y no Reportes", + "Por Idioma, Calidad y no Reportes" + ] + }, + { + "id": "pordedeshowlinks", + "type": "list", + "label": "Mostrar enlaces", + "default": 0, + "enabled": true, + "visible": "!eq(-3,'') + !eq(-4,'')", + "lvalues": [ + "Todos", + "Ver online", + "Descargar" + ] + }, + { + "id": "pordedenumberlinks", + "type": "list", + "label": "Limitar número de enlaces", + "default": 0, + "enabled": true, + "visible": "!eq(-4,'') + !eq(-5,'')", + "lvalues": [ + "No", + "5", + "10", + "15", + "20", + "25", + "30" + ] + } + ] +} diff --git a/plugin.video.alfa/channels/pordede.py b/plugin.video.alfa/channels/pordede.py new file mode 100644 index 00000000..29347d39 --- /dev/null +++ b/plugin.video.alfa/channels/pordede.py @@ -0,0 +1,665 @@ +# -*- coding: utf-8 -*- + +import os +import re +import sys +import urlparse + +from core import channeltools +from core import httptools +from core import jsontools +from core import scrapertools +from core import servertools +from core.item import Item +from platformcode import config, logger +from platformcode import platformtools + +def login(): + url_origen = "http://www.pordede.com" + data = httptools.downloadpage(url_origen).data + if config.get_setting("pordedeuser", "pordede") in data: + return True + + url = "http://www.pordede.com/api/login/auth?response_type=code&client_id=appclient&redirect_uri=http%3A%2F%2Fwww.pordede.com%2Fapi%2Flogin%2Freturn&state=none" + post = "username=%s&password=%s&authorized=autorizar" % (config.get_setting("pordedeuser", "pordede"), config.get_setting("pordedepassword", "pordede")) + data = httptools.downloadpage(url, post).data + if '"ok":true' in data: + return True + else: + return False + +def mainlist(item): + logger.info() + + itemlist = [] + + if not config.get_setting("pordedeuser", "pordede"): + itemlist.append( Item( channel=item.channel , title="Habilita tu cuenta en la configuración..." , action="settingCanal" , url="") ) + else: + result = login() + if not result: + itemlist.append(Item(channel=item.channel, action="mainlist", title="Login fallido. Volver a intentar...")) + return itemlist + itemlist.append( Item(channel=item.channel, action="menuseries" , title="Series" , url="" )) + itemlist.append( Item(channel=item.channel, action="menupeliculas" , title="Películas y documentales" , url="" )) + itemlist.append( Item(channel=item.channel, action="listas_sigues" , title="Listas que sigues" , url="http://www.pordede.com/lists/following" )) + itemlist.append( Item(channel=item.channel, action="tus_listas" , title="Tus listas" , url="http://www.pordede.com/lists/yours" )) + itemlist.append( Item(channel=item.channel, action="listas_sigues" , title="Top listas" , url="http://www.pordede.com/lists" )) + itemlist.append( Item(channel=item.channel, action="settingCanal" , title="Configuración..." , url="" )) + + return itemlist + +def settingCanal(item): + return platformtools.show_channel_settings() + +def menuseries(item): + logger.info() + + itemlist = [] + itemlist.append( Item(channel=item.channel, action="peliculas" , title="Novedades" , url="http://www.pordede.com/series/loadmedia/offset/0/showlist/hot" )) + itemlist.append( Item(channel=item.channel, action="generos" , title="Por géneros" , url="http://www.pordede.com/series" )) + itemlist.append( Item(channel=item.channel, action="peliculas" , title="Siguiendo" , url="http://www.pordede.com/series/following" )) + itemlist.append( Item(channel=item.channel, action="siguientes" , title="Siguientes Capítulos" , url="http://www.pordede.com/main/index" , viewmode="movie")) + itemlist.append( Item(channel=item.channel, action="peliculas" , title="Favoritas" , url="http://www.pordede.com/series/favorite" )) + itemlist.append( Item(channel=item.channel, action="peliculas" , title="Pendientes" , url="http://www.pordede.com/series/pending" )) + itemlist.append( Item(channel=item.channel, action="peliculas" , title="Terminadas" , url="http://www.pordede.com/series/seen" )) + itemlist.append( Item(channel=item.channel, action="peliculas" , title="Recomendadas" , url="http://www.pordede.com/series/recommended" )) + itemlist.append( Item(channel=item.channel, action="search" , title="Buscar..." , url="http://www.pordede.com/series" )) + + return itemlist + +def menupeliculas(item): + logger.info() + + itemlist = [] + itemlist.append( Item(channel=item.channel, action="peliculas" , title="Novedades" , url="http://www.pordede.com/pelis/loadmedia/offset/0/showlist/hot" )) + itemlist.append( Item(channel=item.channel, action="generos" , title="Por géneros" , url="http://www.pordede.com/pelis" )) + itemlist.append( Item(channel=item.channel, action="peliculas" , title="Favoritas" , url="http://www.pordede.com/pelis/favorite" )) + itemlist.append( Item(channel=item.channel, action="peliculas" , title="Pendientes" , url="http://www.pordede.com/pelis/pending" )) + itemlist.append( Item(channel=item.channel, action="peliculas" , title="Vistas" , url="http://www.pordede.com/pelis/seen" )) + itemlist.append( Item(channel=item.channel, action="peliculas" , title="Recomendadas" , url="http://www.pordede.com/pelis/recommended" )) + itemlist.append( Item(channel=item.channel, action="search" , title="Buscar..." , url="http://www.pordede.com/pelis" )) + + return itemlist + +def generos(item): + logger.info() + + # Descarga la pagina + data = httptools.downloadpage(item.url).data + + # Extrae las entradas (carpetas) + data = scrapertools.find_single_match(data,'
([0-9]+)' + + return parse_listas(item, patron) + +def tus_listas(item): + logger.info() + + patron = '
([0-9]+)' + + return parse_listas(item, patron) + +def lista(item): + logger.info() + + # Descarga la pagina + headers = {"X-Requested-With": "XMLHttpRequest"} + data = httptools.downloadpage(item.url, headers=headers).data + + # Extrae las entradas (carpetas) + json_object = jsontools.load(data) + data = json_object["html"] + + return parse_mixed_results(item,data) + +def findvideos(item, verTodos=False): + logger.info() + + # Descarga la pagina + data = httptools.downloadpage(item.url).data + logger.info(data) + + sesion = scrapertools.find_single_match(data,'SESS = "([^"]+)";') + + patron = '