From 4b9a86f6441cd640c3dd5c5ca5086e438248ed74 Mon Sep 17 00:00:00 2001 From: alfa-addon Date: Sat, 27 Jan 2018 20:36:49 -0500 Subject: [PATCH] added --- plugin.video.alfa/channels/todopeliculas.json | 44 +++++ plugin.video.alfa/channels/todopeliculas.py | 172 ++++++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 plugin.video.alfa/channels/todopeliculas.json create mode 100644 plugin.video.alfa/channels/todopeliculas.py diff --git a/plugin.video.alfa/channels/todopeliculas.json b/plugin.video.alfa/channels/todopeliculas.json new file mode 100644 index 00000000..2e0087a5 --- /dev/null +++ b/plugin.video.alfa/channels/todopeliculas.json @@ -0,0 +1,44 @@ +{ + "id": "todopeliculas", + "name": "TodoPeliculas", + "active": true, + "adult": false, + "language": ["cast"], + "thumbnail": "http://www.todo-peliculas.com/images/logo.png", + "banner": "", + "version": 1, + "categories": [ + "movie", + "torrent" + ], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": false, + "enabled": false, + "visible": false + }, + { + "id": "filter_languages", + "type": "list", + "label": "Mostrar enlaces en idioma...", + "default": 0, + "enabled": true, + "visible": true, + "lvalues": [ + "No filtrar", + "Castellano" + ] + }, + { + "id": "include_in_newest_peliculas", + "type": "bool", + "label": "Incluir en Novedades - Peliculas", + "default": true, + "enabled": true, + "visible": true + } + ] +} \ No newline at end of file diff --git a/plugin.video.alfa/channels/todopeliculas.py b/plugin.video.alfa/channels/todopeliculas.py new file mode 100644 index 00000000..c6d4781c --- /dev/null +++ b/plugin.video.alfa/channels/todopeliculas.py @@ -0,0 +1,172 @@ +# -*- coding: utf-8 -*- +# -*- Channel TodoPeliculas -*- +# -*- Created for Alfa-addon -*- +# -*- By the Alfa Develop Group -*- + +import re +from core import httptools +from core import scrapertools +from core.item import Item +from channels import filtertools +from channels import autoplay +from platformcode import config, logger + + +IDIOMAS = {'cast': 'Castellano'} +list_language = IDIOMAS.values() +list_quality = [] +list_servers = ['torrent'] + +host = 'http://www.todo-peliculas.com/' + + +def mainlist(item): + logger.info() + + autoplay.init(item.channel, list_servers, list_quality) + + itemlist = list() + itemlist.append(item.clone(title="Ultimas", action="list_all", url=host+'torrents')) + itemlist.append(item.clone(title="Por Calidad", action="section", url=host)) + itemlist.append(item.clone(title="Buscar", action="search", url=host+'buscar?searchword=')) + + autoplay.show_option(item.channel, itemlist) + + return itemlist + + +def get_source(url): + logger.info() + data = httptools.downloadpage(url).data + data = re.sub(r'"|\n|\r|\t| |
|\s{2,}', "", data) + return data + + +def list_all(item): + logger.info() + itemlist = [] + + data = get_source(item.url) + if item.type == 'buscar': + patron = '
' + elif item.type == 'section': + patron = '
.*?href=(.*?)>.*?src=(.*?) alt.*?title=(.*?)>' + else: + patron = '
.*?src=(.*?) onload' + matches = re.compile(patron, re.DOTALL).findall(data) + + for info_1, info_2, info_3 in matches: + + if item.type != 'section': + url = host+info_2 + quality = scrapertools.find_single_match(info_1, '\[(.*?)\]') + contentTitle = re.sub(r'\[.*?\]', '', info_1) + title = '%s [%s]'%(contentTitle, quality) + thumbnail = info_3 + + else: + url = host + info_1 + quality = scrapertools.find_single_match(info_3, '\[(.*?)\]') + contentTitle = re.sub(r'\[.*?\]', '', info_3) + title = '%s [%s]' % (contentTitle, quality) + thumbnail = info_2 + quality = '' + + if quality == '': + title = title.replace('[]', '') + + itemlist.append(item.clone(action='findvideos', + title=title, + url=url, + thumbnail=thumbnail, + contentTitle=contentTitle, + quality = quality + )) + + # Paginación + + url_next_page = scrapertools.find_single_match(data,'Anterior.*?Siguiente') + if url_next_page: + itemlist.append(item.clone(title="Siguiente >>", url=host+url_next_page, action='list_all')) + return itemlist + +def section(item): + logger.info() + itemlist = [] + + data = get_source(host) + patron = '
  • 0 and item.extra != 'findvideos': + itemlist.append( + Item(channel=item.channel, title='[COLOR yellow]AƱadir esta pelicula a la videoteca[/COLOR]', url=item.url, + action="add_pelicula_to_library", extra="findvideos", contentTitle=item.contentTitle)) + + return itemlist + + +def search(item, texto): + logger.info() + texto = texto.replace(" ", "+") + item.url = item.url + texto + item.type = 'buscar' + + if texto != '': + return list_all(item) + else: + return [] + + +def newest(categoria): + logger.info() + itemlist = [] + item = Item() + try: + if categoria in ['peliculas']: + item.url = host+'torrents' + itemlist = list_all(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