From 8bee9bfed0f379d33a2aed226801ead653475d39 Mon Sep 17 00:00:00 2001 From: pipcat Date: Thu, 4 Oct 2018 18:57:12 +0200 Subject: [PATCH 1/4] =?UTF-8?q?M=C3=A1s=20opciones=20para=20seleccionar=20?= =?UTF-8?q?canales=20d=C3=B3nde=20buscar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin.video.alfa/channels/search.py | 58 ++++++++++++++++++---------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/plugin.video.alfa/channels/search.py b/plugin.video.alfa/channels/search.py index 63075bbb..90ea7199 100644 --- a/plugin.video.alfa/channels/search.py +++ b/plugin.video.alfa/channels/search.py @@ -154,7 +154,7 @@ def setting_channel_new(item): # Cargar lista de opciones (canales activos del usuario y que permitan búsqueda global) # ------------------------ - lista = []; ids = []; lista_lang = [] + lista = []; ids = []; lista_lang = []; lista_ctgs = [] channels_list = channelselector.filterchannels('all') for channel in channels_list: channel_parameters = channeltools.get_channel_parameters(channel.channel) @@ -171,36 +171,52 @@ def setting_channel_new(item): lista.append(it) ids.append(channel.channel) lista_lang.append(channel_parameters['language']) + lista_ctgs.append(channel_parameters['categories']) # Diálogo para pre-seleccionar # ---------------------------- - preselecciones_std = ['Modificar selección actual', 'Modificar partiendo de Todos', 'Modificar partiendo de Ninguno', 'Modificar partiendo de Castellano', 'Modificar partiendo de Latino'] - if item.action == 'setting_channel': - # Configuración de los canales incluídos en la búsqueda - preselecciones = preselecciones_std - presel_values = [1, 2, 3, 4, 5] - else: - # Llamada desde "buscar en otros canales" (se puede saltar la selección e ir directo a la búsqueda) - preselecciones = ['Buscar con la selección actual'] + preselecciones_std - presel_values = [0, 1, 2, 3, 4, 5] + preselecciones = [ + 'Buscar con la selección actual', + 'Modificar selección actual', + 'Modificar partiendo de Todos', + 'Modificar partiendo de Ninguno', + 'Modificar partiendo de Castellano', + 'Modificar partiendo de Latino' + ] + presel_values = ['skip', 'actual', 'all', 'none', 'cast', 'lat'] + + categs = ['movie', 'tvshow', 'documentary', 'anime', 'vos', 'direct', 'torrent'] + if config.get_setting('adult_mode') > 0: categs.append('adult') + for c in categs: + preselecciones.append('Modificar partiendo de %s' % config.get_localized_category(c)) + presel_values.append(c) + + if item.action == 'setting_channel': # Configuración de los canales incluídos en la búsqueda + del preselecciones[0] + del presel_values[0] + #else: # Llamada desde "buscar en otros canales" (se puede saltar la selección e ir directo a la búsqueda) ret = platformtools.dialog_select(config.get_localized_string(59994), preselecciones) if ret == -1: return False # pedido cancel - if presel_values[ret] == 0: return True # continuar sin modificar - elif presel_values[ret] == 3: preselect = [] - elif presel_values[ret] == 2: preselect = range(len(ids)) - elif presel_values[ret] in [4, 5]: - busca = 'cast' if presel_values[ret] == 4 else 'lat' + if presel_values[ret] == 'skip': return True # continuar sin modificar + elif presel_values[ret] == 'none': preselect = [] + elif presel_values[ret] == 'all': preselect = range(len(ids)) + elif presel_values[ret] in ['cast', 'lat']: preselect = [] for i, lg in enumerate(lista_lang): - if busca in lg or '*' in lg: + if presel_values[ret] in lg or '*' in lg: preselect.append(i) - else: + elif presel_values[ret] == 'actual': preselect = [] for i, canal in enumerate(ids): channel_status = config.get_setting('include_in_global_search', canal) if channel_status: preselect.append(i) + else: + preselect = [] + for i, ctgs in enumerate(lista_ctgs): + if presel_values[ret] in ctgs: + preselect.append(i) # Diálogo para seleccionar # ------------------------ @@ -493,10 +509,10 @@ def do_search(item, categories=None): if categories: # Si no se ha seleccionado torrent no se muestra - if "torrent" not in categories and "infoPlus" not in categories: - if "torrent" in channel_parameters["categories"]: - logger.info("%s -torrent-" % basename_without_extension) - continue + #if "torrent" not in categories and "infoPlus" not in categories: + # if "torrent" in channel_parameters["categories"]: + # logger.info("%s -torrent-" % basename_without_extension) + # continue for cat in categories: if cat not in channel_parameters["categories"]: From 00310bb8021b30fb568a2c50851354c07bf1d69c Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 10 Oct 2018 15:31:53 -0300 Subject: [PATCH 2/4] mi pr --- plugin.video.alfa/channels/bloghorror.json | 68 +++++ plugin.video.alfa/channels/bloghorror.py | 234 ++++++++++++++++++ plugin.video.alfa/channels/pelkex.json | 66 +++++ plugin.video.alfa/channels/pelkex.py | 188 ++++++++++++++ plugin.video.alfa/channels/special.json | 12 + plugin.video.alfa/channels/special.py | 78 ++++++ .../platformcode/platformtools.py | 13 +- plugin.video.alfa/platformcode/unify.py | 1 + 8 files changed, 656 insertions(+), 4 deletions(-) create mode 100644 plugin.video.alfa/channels/bloghorror.json create mode 100644 plugin.video.alfa/channels/bloghorror.py create mode 100644 plugin.video.alfa/channels/pelkex.json create mode 100644 plugin.video.alfa/channels/pelkex.py create mode 100644 plugin.video.alfa/channels/special.json create mode 100644 plugin.video.alfa/channels/special.py diff --git a/plugin.video.alfa/channels/bloghorror.json b/plugin.video.alfa/channels/bloghorror.json new file mode 100644 index 00000000..23513828 --- /dev/null +++ b/plugin.video.alfa/channels/bloghorror.json @@ -0,0 +1,68 @@ +{ + "id": "bloghorror", + "name": "BlogHorror", + "active": true, + "adult": false, + "language": [""], + "thumbnail": "", + "banner": "", + "categories": [ + "movie", + "vo", + "torrent" + ], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": false, + "enabled": false, + "visible": false + }, + { + "id": "include_in_newest_peliculas", + "type": "bool", + "label": "Incluir en Novedades - Peliculas", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_latino", + "type": "bool", + "label": "Incluir en Novedades - Latino", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_infantiles", + "type": "bool", + "label": "Incluir en Novedades - Infantiles", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_terror", + "type": "bool", + "label": "Incluir en Novedades - terror", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "filter_languages", + "type": "list", + "label": "Mostrar enlaces en idioma...", + "default": 0, + "enabled": true, + "visible": true, + "lvalues": [ + "No filtrar", + "LAT" + ] + } + ] +} diff --git a/plugin.video.alfa/channels/bloghorror.py b/plugin.video.alfa/channels/bloghorror.py new file mode 100644 index 00000000..0004b752 --- /dev/null +++ b/plugin.video.alfa/channels/bloghorror.py @@ -0,0 +1,234 @@ +# -*- coding: utf-8 -*- +# -*- Channel BlogHorror -*- +# -*- Created for Alfa-addon -*- +# -*- By the Alfa Develop Group -*- + +import os +import re + +from channels import autoplay +from channels import filtertools +from core import httptools +from core import scrapertools +from core import servertools +from core import tmdb +from core.item import Item +from platformcode import config, logger +from channelselector import get_thumb + +host = 'http://bloghorror.com/' +fanart = 'http://bloghorror.com/wp-content/uploads/2015/04/bloghorror-2017-x.jpg' + +def get_source(url): + logger.info() + data = httptools.downloadpage(url).data + data = re.sub(r'\n|\r|\t| |
|\s{2,}', "", data) + return data + +def mainlist(item): + logger.info() + + itemlist = [] + + itemlist.append(Item(channel=item.channel, fanart=fanart, title="Todas", action="list_all", url=host, + thumbnail=get_thumb('all', auto=True))) + + itemlist.append(Item(channel=item.channel, fanart=fanart, title="Asiaticas", action="list_all", + url=host+'/category/asiatico', thumbnail=get_thumb('asiaticas', auto=True))) + + itemlist.append(Item(channel=item.channel, fanart=fanart, title = 'Buscar', action="search", url=host + '?s=', pages=3, + thumbnail=get_thumb('search', auto=True))) + + return itemlist + + +def list_all(item): + logger.info() + + itemlist = [] + data = get_source(item.url) + patron = '.?<.*?href="([^"]+)" title="([^"]+)".*?src="([^"]+)".*?' + + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, scrapedtitle, scrapedthumbnail in matches: + url = scrapedurl + title = scrapertools.find_single_match(scrapedtitle, '(.*?)(?:|\(|\| )\d{4}').strip() + year = scrapertools.find_single_match(scrapedtitle, '(\d{4})') + thumbnail = scrapedthumbnail + new_item = Item(channel=item.channel, fanart=fanart, title=title, url=url, action='findvideos', + thumbnail=thumbnail, infoLabels={'year':year}) + + new_item.contentTitle=title + itemlist.append(new_item) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + # Paginacion + + if itemlist != []: + + next_page = scrapertools.find_single_match(data, '' + + matches = re.compile(patron, re.DOTALL).findall(data) + + for url, title in matches: + + itemlist.append(Item(channel=item.channel, fanart=fanart, title=title, url=url, action='list_all', pages=3)) + + return itemlist + + +def findvideos(item): + logger.info() + + itemlist = [] + full_data = get_source(item.url) + data = scrapertools.find_single_match(full_data, '>FICHA TECNICA:<.*?') + #patron = '(?:bold|strong>|
|)([^<]+)(?:|
).*?="(magnet[^"]+)"' + patron = '(?:|
|/> )(DVD|720|1080)(?:|
|).*?="(magnet[^"]+)"' + matches = re.compile(patron, re.DOTALL).findall(data) + + if len(matches) == 0: + 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() + itemlist = [] + texto = texto.replace(" ", "+") + item.url = item.url + texto + if texto != '': + try: + return list_all(item) + except: + itemlist.append(item.clone(url='', title='No hay elementos...', action='')) + return itemlist + +def newest(categoria): + logger.info() + itemlist = [] + item = Item() + try: + if categoria in ['peliculas', 'terror', 'torrent']: + item.url = host + 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 + + +def get_sub_from_subdivx(sub_url, sub_num): + logger.info() + + import xbmc + from time import sleep + import urlparse + sub_dir = os.path.join(config.get_data_path(), 'temp_subs') + + if os.path.exists(sub_dir): + for sub_file in os.listdir(sub_dir): + old_sub = os.path.join(sub_dir, sub_file) + os.remove(old_sub) + + sub_data = httptools.downloadpage(sub_url, follow_redirects=False) + + if 'x-frame-options' not in sub_data.headers: + sub_url = 'http://subdivx.com/sub%s/%s' % (sub_num, sub_data.headers['location']) + sub_url = sub_url.replace('http:///', '') + sub_data = httptools.downloadpage(sub_url).data + + fichero_rar = os.path.join(config.get_data_path(), "subtitle.rar") + outfile = open(fichero_rar, 'wb') + outfile.write(sub_data) + outfile.close() + xbmc.executebuiltin("XBMC.Extract(%s, %s/temp_subs)" % (fichero_rar, config.get_data_path())) + sleep(1) + if len(os.listdir(sub_dir)) > 0: + sub = os.path.join(sub_dir, os.listdir(sub_dir)[0]) + else: + sub = '' + else: + logger.info('sub no valido') + sub = '' + return sub + diff --git a/plugin.video.alfa/channels/pelkex.json b/plugin.video.alfa/channels/pelkex.json new file mode 100644 index 00000000..68e0bf04 --- /dev/null +++ b/plugin.video.alfa/channels/pelkex.json @@ -0,0 +1,66 @@ +{ + "id": "pelkex", + "name": "Pelkex", + "active": true, + "adult": false, + "language": ["lat"], + "thumbnail": "http://pelkex.net/wp-content/uploads/2018/06/35227842_1998485733529574_5906247779155443712_n.png", + "banner": "", + "categories": [ + "movie" + ], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": false, + "enabled": false, + "visible": false + }, + { + "id": "include_in_newest_peliculas", + "type": "bool", + "label": "Incluir en Novedades - Peliculas", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_latino", + "type": "bool", + "label": "Incluir en Novedades - Latino", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_infantiles", + "type": "bool", + "label": "Incluir en Novedades - Infantiles", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_terror", + "type": "bool", + "label": "Incluir en Novedades - terror", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "filter_languages", + "type": "list", + "label": "Mostrar enlaces en idioma...", + "default": 0, + "enabled": true, + "visible": true, + "lvalues": [ + "No filtrar", + "LAT" + ] + } + ] +} diff --git a/plugin.video.alfa/channels/pelkex.py b/plugin.video.alfa/channels/pelkex.py new file mode 100644 index 00000000..e74b6bbb --- /dev/null +++ b/plugin.video.alfa/channels/pelkex.py @@ -0,0 +1,188 @@ +# -*- coding: utf-8 -*- +# -*- Channel Pelkex -*- +# -*- Created for Alfa-addon -*- +# -*- By the Alfa Develop Group -*- + +import re + +from channels import autoplay +from channels import filtertools +from core import httptools +from core import scrapertools +from core import servertools +from core import tmdb +from core.item import Item +from platformcode import config, logger +from channelselector import get_thumb + +host = 'http://pelkex.net/' + +IDIOMAS = {'Latino': 'LAT'} +list_language = IDIOMAS.values() +list_quality = [] +list_servers = ['openload', 'streamango', 'fastplay', 'okru', 'rapidvideo'] + +def get_source(url): + logger.info() + data = httptools.downloadpage(url).data + data = re.sub(r'\n|\r|\t| |
|\s{2,}', "", data) + return data + +def mainlist(item): + logger.info() + + autoplay.init(item.channel, list_servers, list_quality) + itemlist = [] + + itemlist.append(Item(channel=item.channel, title="Todas", action="list_all", url=host + '?s=', pages=2, + thumbnail=get_thumb('all', auto=True))) + + itemlist.append(Item(channel=item.channel, title="Generos", action="section", + thumbnail=get_thumb('genres', auto=True))) + + itemlist.append(Item(channel=item.channel, title="Por Años", action="section", + thumbnail=get_thumb('year', auto=True))) + + itemlist.append(Item(channel=item.channel, title = 'Buscar', action="search", url=host + '?s=', pages=3, + thumbnail=get_thumb('search', auto=True))) + + autoplay.show_option(item.channel, itemlist) + + return itemlist + + +def list_all(item): + logger.info() + + itemlist = [] + i = 1 + while i <= item.pages: + try: + data = get_source(item.url) + except: + break + patron = '
([^.*?' + patron += '

([^<]+)

.*?(\d{4})' + + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, scrapedthumbnail, scrapedtitle, plot, year in matches: + url = scrapedurl + scrapedtitle = scrapedtitle + thumbnail = scrapedthumbnail + new_item = Item(channel=item.channel, title=scrapedtitle, url=url, action='findvideos', + thumbnail=thumbnail, plot=plot, infoLabels={'year':year}) + + new_item.contentTitle=scrapedtitle + itemlist.append(new_item) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + # Paginacion + + if itemlist != []: + + next_page = scrapertools.find_single_match(data, "href='#'>\d+
  • " + "") + if next_page != '' and i == item.pages: + itemlist.append(Item(channel=item.channel, action="list_all", title='Siguiente >>>', url=next_page, + pages=item.pages)) + else: + item.url=next_page + i += 1 + + return itemlist + + + +def section(item): + logger.info() + + itemlist = [] + data=get_source(host) + if item.title == 'Generos': + data = scrapertools.find_single_match(data, 'tabindex="0">Generos<.*?') + elif 'Años' in item.title: + data = scrapertools.find_single_match(data, 'tabindex="0">Año<.*?') + + patron = 'href="([^"]+)">([^<]+)' + + matches = re.compile(patron, re.DOTALL).findall(data) + + for url, title in matches: + + itemlist.append(Item(channel=item.channel, title=title, url=url, action='list_all', pages=3)) + + return itemlist + + +def findvideos(item): + logger.info() + + itemlist = [] + data = get_source(item.url) + patron = '
    <(?:iframe|IFRAME).*?(?:src|SRC)="([^"]+)"' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl in matches: + if 'http' not in scrapedurl: + url = 'http:'+scrapedurl + else: + url = scrapedurl + + itemlist.append(Item(channel=item.channel, title='%s', url=url, action='play', language=IDIOMAS['Latino'], + infoLabels=item.infoLabels)) + + itemlist = servertools.get_servers_itemlist(itemlist, lambda x: x.title % x.server.capitalize()) + + # Requerido para FilterTools + + itemlist = filtertools.get_links(itemlist, item, list_language) + + # Requerido para AutoPlay + + autoplay.start(itemlist, item) + + if config.get_videolibrary_support() and len(itemlist) > 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() + itemlist = [] + texto = texto.replace(" ", "+") + item.url = item.url + texto + if texto != '': + try: + return list_all(item) + except: + itemlist.append(item.clone(url='', title='No hay elementos...', action='')) + return itemlist + +def newest(categoria): + logger.info() + itemlist = [] + item = Item() + try: + if categoria in ['peliculas', 'latino']: + item.url = host + '?s=' + elif categoria == 'infantiles': + item.url = host + 'genre/animacion/' + elif categoria == 'terror': + item.url = host + 'genre/terror/' + item.pages=3 + 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 + diff --git a/plugin.video.alfa/channels/special.json b/plugin.video.alfa/channels/special.json new file mode 100644 index 00000000..ace9d3a0 --- /dev/null +++ b/plugin.video.alfa/channels/special.json @@ -0,0 +1,12 @@ +{ + "id": "special", + "name": "", + "active": true, + "adult": false, + "language": [], + "thumbnail": "https://i.postimg.cc/FR2nygS0/g4567.png", + "banner": "", + "categories": [ + "movie" + ] +} diff --git a/plugin.video.alfa/channels/special.py b/plugin.video.alfa/channels/special.py new file mode 100644 index 00000000..836d9c19 --- /dev/null +++ b/plugin.video.alfa/channels/special.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- +# -*- Channel Halloween -*- +# -*- Created for Alfa-addon -*- +# -*- By the Alfa Develop Group -*- + +import re + +from channels import autoplay +from channels import filtertools +from core import httptools +from core import scrapertools +from core import servertools +from core import jsontools +from core import tmdb +from core.item import Item +from platformcode import config, logger +from channelselector import get_thumb + +host = 'https://www.imdb.com/list/ls027655523/?sort=list_order,asc&st_dt=&mode=detail&page=' + + +def get_source(url): + logger.info() + data = httptools.downloadpage(url).data + data = re.sub(r'\n|\r|\t| |
    |\s{2,}', "", data) + return data + +def mainlist(item): + logger.info() + item.url = host + item.first = 60 + item.last = 80 + item.page = 1 + return list_all(item) + + +def list_all(item): + logger.info() + from core import jsontools + itemlist = [] + + data = get_source('%s%s' % (host, item.page)) + data = scrapertools.find_single_match(data, '"itemListElement":([^\]]+)\]') + data = data + ']' + #logger.debug(data) + movie_list = eval(data) + for movie in movie_list[item.first:item.last]: + + IMDBNumber = movie['url'].replace('title','').replace('/','') + + + new_item = Item(channel='search', contentType='movie', action='do_search', + infoLabels={'imdb_id': IMDBNumber}) + + #new_item.infoLabels = tmdb.find_and_set_infoLabels(new_item) + itemlist.append(new_item) + logger.debug('id %s' % IMDBNumber) + #logger.debug(new_item) + + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + for movie in itemlist: + movie.title = movie.infoLabels['title'] + movie.wanted = movie.title + + if item.last + 20 < len(movie_list): + first = item.last + last = item.last + 20 + page = item.page + else: + first = 0 + last = 20 + page = item.page + 1 + + itemlist.append(Item(channel=item.channel, title='Siguiente >>', action='list_all', + last=last, first=first, page=page)) + return itemlist diff --git a/plugin.video.alfa/platformcode/platformtools.py b/plugin.video.alfa/platformcode/platformtools.py index 7fe2fc62..92b7e881 100644 --- a/plugin.video.alfa/platformcode/platformtools.py +++ b/plugin.video.alfa/platformcode/platformtools.py @@ -229,8 +229,10 @@ def render_items(itemlist, parent_item): set_infolabels(listitem, item) # Montamos el menu contextual - context_commands = set_context_commands(item, parent_item) - + if parent_item.channel != 'special': + context_commands = set_context_commands(item, parent_item) + else: + context_commands = [] # Añadimos el item if config.get_platform(True)['num_version'] >= 17.0 and parent_item.list_type == '': listitem.addContextMenuItems(context_commands) @@ -1091,16 +1093,19 @@ def play_torrent(item, xlistitem, mediaurl): mediaurl += "&episode=%s&library=&season=%s&show=%s&tmdb=%s&type=episode" % (item.infoLabels['episode'], item.infoLabels['season'], item.infoLabels['tmdb_id'], item.infoLabels['tmdb_id']) elif item.contentType == 'movie': mediaurl += "&library=&tmdb=%s&type=movie" % (item.infoLabels['tmdb_id']) - + xbmc.executebuiltin("PlayMedia(" + torrent_options[seleccion][1] % mediaurl + ")") #Seleccionamos que clientes torrent soportamos para el marcado de vídeos vistos: asumimos que todos funcionan #if "quasar" in torrent_options[seleccion][1] or "elementum" in torrent_options[seleccion][1]: + time_limit = time.time() + 150 #Marcamos el timepo máx. de buffering while not is_playing() and time.time() < time_limit: #Esperamos mientra buffera time.sleep(5) #Repetimos cada intervalo #logger.debug(str(time_limit)) - + if item.subtitle != '': + xbmc_player.setSubtitles(item.subtitle) + if item.strm_path and is_playing(): #Sólo si es de Videoteca from platformcode import xbmc_videolibrary xbmc_videolibrary.mark_auto_as_watched(item) #Marcamos como visto al terminar diff --git a/plugin.video.alfa/platformcode/unify.py b/plugin.video.alfa/platformcode/unify.py index 70536b18..d095ad7d 100644 --- a/plugin.video.alfa/platformcode/unify.py +++ b/plugin.video.alfa/platformcode/unify.py @@ -49,6 +49,7 @@ thumb_dict = {"movies": "https://s10.postimg.cc/fxtqzdog9/peliculas.png", "animacion": "https://s14.postimg.cc/vl193mupd/animation.png", "anime" : "https://s10.postimg.cc/n9mc2ikzt/anime.png", "artes marciales" : "https://s10.postimg.cc/4u1v51tzt/martial_arts.png", + "asiaticas" : "https://i.postimg.cc/Xq0HXD5d/asiaticas.png", "aventura": "https://s14.postimg.cc/ky7fy5he9/adventure.png", "belico": "https://s14.postimg.cc/5e027lru9/war.png", "biografia" : "https://s10.postimg.cc/jq0ecjxnt/biographic.png", From 584e3929f1267ade7e2911f292fc7f66f7006201 Mon Sep 17 00:00:00 2001 From: Intel1 Date: Wed, 10 Oct 2018 14:08:00 -0500 Subject: [PATCH 3/4] Actualizados MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cinehindi: cambio de esctructura kbagi: eliminado, no existe peliscon: eliminado, no existe plusdede: eliminado, no existe repelis: cambio cosmético rexpelis: nuevo canal yape: cambio cosmético Nuevo fantart por halloween --- plugin.video.alfa/channels/cinehindi.py | 67 +- plugin.video.alfa/channels/kbagi.json | 81 -- plugin.video.alfa/channels/kbagi.py | 384 --------- plugin.video.alfa/channels/peliscon.json | 30 - plugin.video.alfa/channels/peliscon.py | 378 --------- plugin.video.alfa/channels/plusdede.json | 85 -- plugin.video.alfa/channels/plusdede.py | 961 ----------------------- plugin.video.alfa/channels/repelis.json | 2 +- plugin.video.alfa/channels/rexpelis.json | 76 ++ plugin.video.alfa/channels/rexpelis.py | 299 +++++++ plugin.video.alfa/channels/yape.py | 6 +- plugin.video.alfa/fanart.jpg | Bin 2812412 -> 1001865 bytes plugin.video.alfa/fanart1.jpg | Bin 0 -> 2812412 bytes plugin.video.alfa/servers/kbagi.json | 43 - plugin.video.alfa/servers/kbagi.py | 55 -- 15 files changed, 420 insertions(+), 2047 deletions(-) delete mode 100644 plugin.video.alfa/channels/kbagi.json delete mode 100644 plugin.video.alfa/channels/kbagi.py delete mode 100755 plugin.video.alfa/channels/peliscon.json delete mode 100755 plugin.video.alfa/channels/peliscon.py delete mode 100755 plugin.video.alfa/channels/plusdede.json delete mode 100644 plugin.video.alfa/channels/plusdede.py create mode 100644 plugin.video.alfa/channels/rexpelis.json create mode 100644 plugin.video.alfa/channels/rexpelis.py create mode 100644 plugin.video.alfa/fanart1.jpg delete mode 100644 plugin.video.alfa/servers/kbagi.json delete mode 100644 plugin.video.alfa/servers/kbagi.py diff --git a/plugin.video.alfa/channels/cinehindi.py b/plugin.video.alfa/channels/cinehindi.py index dcb59acf..1e830539 100755 --- a/plugin.video.alfa/channels/cinehindi.py +++ b/plugin.video.alfa/channels/cinehindi.py @@ -3,25 +3,34 @@ import re import urlparse +from channelselector import get_thumb +from channels import autoplay +from channels import filtertools from core import httptools from core import scrapertools from core import servertools +from core import tmdb from core.item import Item from platformcode import config, logger +IDIOMAS = {'Hindi': 'Hindi'} +list_language = IDIOMAS.values() +list_quality = [] +list_servers = ['openload', 'netutv'] + host = "http://www.cinehindi.com/" def mainlist(item): logger.info() - + autoplay.init(item.channel, list_servers, list_quality) itemlist = list() - - itemlist.append(Item(channel=item.channel, action="genero", title="Generos", url=host)) - itemlist.append(Item(channel=item.channel, action="lista", title="Novedades", url=host)) + itemlist.append(Item(channel=item.channel, action="genero", title="Generos", url=host, thumbnail = get_thumb("genres", auto = True))) + itemlist.append(Item(channel=item.channel, action="lista", title="Novedades", url=host, thumbnail = get_thumb("newest", auto = True))) itemlist.append(Item(channel=item.channel, action="proximas", title="Próximas Películas", url=urlparse.urljoin(host, "proximamente"))) - itemlist.append(Item(channel=item.channel, title="Buscar", action="search", url=urlparse.urljoin(host, "?s="))) + itemlist.append(Item(channel=item.channel, title="Buscar", action="search", url=urlparse.urljoin(host, "?s="), thumbnail = get_thumb("search", auto = True))) + autoplay.show_option(item.channel, itemlist) return itemlist @@ -50,9 +59,7 @@ def search(item, texto): def proximas(item): logger.info() - itemlist = [] - data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) # Eliminamos tabuladores, dobles espacios saltos de linea, etc... patron = 'class="item">.*?' # Todos los items de peliculas (en esta web) empiezan con esto @@ -77,40 +84,36 @@ def proximas(item): item.url = next_page_url + 'proximamente/page/' + str(i) + '/' itemlist.append(Item(channel=item.channel, action="proximas", title=">> Página siguiente", url=item.url, thumbnail='https://s32.postimg.cc/4zppxf5j9/siguiente.png')) - return itemlist def lista(item): logger.info() - itemlist = [] - data = httptools.downloadpage(item.url).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) # Eliminamos tabuladores, dobles espacios saltos de linea, etc... patron = 'class="item">.*?' # Todos los items de peliculas (en esta web) empiezan con esto patron += ' 0 and item.contentChannel!='videolibrary': 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=show)) - return itemlist + + +def play(item): + logger.info() + item.thumbnail = item.contentThumbnail + return [item] diff --git a/plugin.video.alfa/channels/kbagi.json b/plugin.video.alfa/channels/kbagi.json deleted file mode 100644 index 9d76045f..00000000 --- a/plugin.video.alfa/channels/kbagi.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "id": "kbagi", - "name": "Kbagi/Diskokosmiko", - "language": ["cast", "lat"], - "active": false, - "adult": false, - "version": 1, - "thumbnail": "http://i.imgur.com/EjbfM7p.png?1", - "banner": "copiapop.png", - "categories": [ - "movie", - "tvshow" - ], - "settings": [ - { - "id": "include_in_global_search", - "type": "bool", - "label": "Incluir en busqueda global", - "default": false, - "enabled": true, - "visible": true - }, - { - "id": "kbagiuser", - "type": "text", - "color": "0xFF25AA48", - "label": "Usuario Kbagi", - "enabled": true, - "visible": true - }, - { - "id": "kbagipassword", - "type": "text", - "color": "0xFF25AA48", - "hidden": true, - "label": "Password Kbagi", - "enabled": "!eq(-1,'')", - "visible": true - }, - { - "id": "diskokosmikouser", - "type": "text", - "color": "0xFFC52020", - "label": "Usuario Diskokosmiko", - "enabled": true, - "visible": true - }, - { - "id": "diskokosmikopassword", - "type": "text", - "color": "0xFFC52020", - "hidden": true, - "label": "Password Diskokosmiko", - "enabled": "!eq(-1,'')", - "visible": true - }, - { - "id": "adult_content", - "type": "bool", - "color": "0xFFd50b0b", - "label": "Mostrar contenido adulto en las búsquedas", - "default": false, - "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" - ] - } - ] -} \ No newline at end of file diff --git a/plugin.video.alfa/channels/kbagi.py b/plugin.video.alfa/channels/kbagi.py deleted file mode 100644 index 7cb297a4..00000000 --- a/plugin.video.alfa/channels/kbagi.py +++ /dev/null @@ -1,384 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -import threading -import urllib -import xbmc - -from core import downloadtools -from core import filetools -from core import httptools -from core import jsontools -from core import scrapertools -from core.item import Item -from platformcode import config, logger -from platformcode import platformtools - -__perfil__ = config.get_setting('perfil', "kbagi") - -# Fijar perfil de color -perfil = [['0xFFFFE6CC', '0xFFFFCE9C', '0xFF994D00', '0xFFFE2E2E', '0xFF088A08'], - ['0xFFA5F6AF', '0xFF5FDA6D', '0xFF11811E', '0xFFFE2E2E', '0xFF088A08'], - ['0xFF58D3F7', '0xFF2E9AFE', '0xFF2E64FE', '0xFFFE2E2E', '0xFF088A08']] - -if __perfil__ - 1 >= 0: - color1, color2, color3, color4, color5 = perfil[__perfil__ - 1] -else: - color1 = color2 = color3 = color4 = color5 = "" - -adult_content = config.get_setting("adult_content", "kbagi") - - -def login(pagina): - logger.info() - try: - dom = pagina.split(".")[0] - user = config.get_setting("%suser" %dom, "kbagi") - password = config.get_setting("%spassword" %dom, "kbagi") - if "kbagi" in pagina: - pagina = "k-bagi.com" - if not user: - return False, "Para ver los enlaces de %s es necesario registrarse en %s" %(dom, pagina) - data = httptools.downloadpage("http://%s" % pagina).data - if re.search(r'(?i)%s' % user, data): - return True, "" - token = scrapertools.find_single_match(data, 'name="__RequestVerificationToken".*?value="([^"]+)"') - post = "__RequestVerificationToken=%s&UserName=%s&Password=%s" % (token, user, password) - headers = {'X-Requested-With': 'XMLHttpRequest'} - url_log = "http://%s/action/Account/Login" % pagina - data = httptools.downloadpage(url_log, post, headers).data - if "redirectUrl" in data: - logger.info("Login correcto") - return True, "" - else: - logger.error("Error en el login") - return False, "Nombre de usuario no válido. Comprueba tus credenciales" - except: - import traceback - logger.error(traceback.format_exc()) - return False, "Error durante el login. Comprueba tus credenciales" - - -def mainlist(item): - logger.info() - itemlist = [] - item.text_color = color1 - logueado, error_message = login("kbagi.com") - if not logueado: - itemlist.append(item.clone(title=error_message, action="configuracion", folder=False)) - else: - item.extra = "http://k-bagi.com" - itemlist.append(item.clone(title="kbagi", action="", text_color=color2)) - itemlist.append( - item.clone(title=" Búsqueda", action="search", url="http://k-bagi.com/action/SearchFiles")) - itemlist.append(item.clone(title=" Colecciones", action="colecciones", - url="http://k-bagi.com/action/home/MoreNewestCollections?pageNumber=1")) - itemlist.append(item.clone(title=" Búsqueda personalizada", action="filtro", - url="http://k-bagi.com/action/SearchFiles")) - itemlist.append(item.clone(title=" Mi cuenta", action="cuenta")) - logueado, error_message = login("diskokosmiko.mx") - if not logueado: - itemlist.append(item.clone(title=error_message, action="configuracion", folder=False)) - else: - item.extra = "http://diskokosmiko.mx/" - itemlist.append(item.clone(title="DiskoKosmiko", action="", text_color=color2)) - itemlist.append(item.clone(title=" Búsqueda", action="search", url="http://diskokosmiko.mx/action/SearchFiles")) - itemlist.append(item.clone(title=" Colecciones", action="colecciones", - url="http://diskokosmiko.mx/action/home/MoreNewestCollections?pageNumber=1")) - itemlist.append(item.clone(title=" Búsqueda personalizada", action="filtro", - url="http://diskokosmiko.mx/action/SearchFiles")) - itemlist.append(item.clone(title=" Mi cuenta", action="cuenta")) - itemlist.append(item.clone(action="", title="")) - folder_thumb = filetools.join(config.get_data_path(), 'thumbs_kbagi') - files = filetools.listdir(folder_thumb) - if files: - itemlist.append( - item.clone(title="Eliminar caché de imágenes (%s)" % len(files), action="delete_cache", text_color="red")) - itemlist.append(item.clone(title="Configuración del canal", action="configuracion", text_color="gold")) - return itemlist - - -def search(item, texto): - logger.info() - item.post = "Mode=List&Type=Video&Phrase=%s&SizeFrom=0&SizeTo=0&Extension=&ref=pager&pageNumber=1" % texto.replace( - " ", "+") - try: - return listado(item) - except: - import sys, traceback - for line in sys.exc_info(): - logger.error("%s" % line) - logger.error(traceback.format_exc()) - return [] - - -def configuracion(item): - ret = platformtools.show_channel_settings() - platformtools.itemlist_refresh() - return ret - - -def listado(item): - logger.info() - itemlist = [] - data_thumb = httptools.downloadpage(item.url, item.post.replace("Mode=List", "Mode=Gallery")).data - if not item.post: - data_thumb = "" - item.url = item.url.replace("/gallery,", "/list,") - data = httptools.downloadpage(item.url, item.post).data - data = re.sub(r"\n|\r|\t|\s{2}| |
    ", "", data) - - folder = filetools.join(config.get_data_path(), 'thumbs_kbagi') - patron = 'data-file-id(.*?

    )
  • ' - bloques = scrapertools.find_multiple_matches(data, patron) - for block in bloques: - if "adult_info" in block and not adult_content: - continue - size = scrapertools.find_single_match(block, '([^<]+)

    ') - patron = 'class="name">
    ([^<]+)<' - scrapedurl, scrapedtitle = scrapertools.find_single_match(block, patron) - scrapedthumbnail = scrapertools.find_single_match(block, "background-image:url\('([^']+)'") - if scrapedthumbnail: - try: - thumb = scrapedthumbnail.split("-", 1)[0].replace("?", "\?") - if data_thumb: - url_thumb = scrapertools.find_single_match(data_thumb, "(%s[^']+)'" % thumb) - else: - url_thumb = scrapedthumbnail - scrapedthumbnail = filetools.join(folder, "%s.jpg" % url_thumb.split("e=", 1)[1][-20:]) - except: - scrapedthumbnail = "" - if scrapedthumbnail: - t = threading.Thread(target=download_thumb, args=[scrapedthumbnail, url_thumb]) - t.setDaemon(True) - t.start() - else: - scrapedthumbnail = item.extra + "/img/file_types/gallery/movie.png" - scrapedurl = item.extra + scrapedurl - title = "%s (%s)" % (scrapedtitle, size) - if "adult_info" in block: - title += " [COLOR %s][+18][/COLOR]" % color4 - plot = scrapertools.find_single_match(block, '
    (.*?)
    ') - if plot: - plot = scrapertools.decodeHtmlentities(plot) - new_item = Item(channel=item.channel, action="findvideos", title=title, url=scrapedurl, - thumbnail=scrapedthumbnail, contentTitle=scrapedtitle, text_color=color2, - extra=item.extra, infoLabels={'plot': plot}, post=item.post) - if item.post: - try: - new_item.folderurl, new_item.foldername = scrapertools.find_single_match(block, - '

    ([^<]+)<') - except: - pass - else: - new_item.folderurl = item.url.rsplit("/", 1)[0] - new_item.foldername = item.foldername - new_item.fanart = item.thumbnail - itemlist.append(new_item) - next_page = scrapertools.find_single_match(data, 'class="pageSplitter.*?" data-nextpage-number="([^"]+)"') - if next_page: - if item.post: - post = re.sub(r'pageNumber=(\d+)', "pageNumber=" + next_page, item.post) - url = item.url - else: - url = re.sub(r',\d+\?ref=pager', ",%s?ref=pager" % next_page, item.url) - post = "" - itemlist.append(Item(channel=item.channel, action="listado", title=">> Página Siguiente (%s)" % next_page, - url=url, post=post, extra=item.extra)) - return itemlist - - -def findvideos(item): - logger.info() - itemlist = [] - itemlist.append(item.clone(action="play", title="Reproducir/Descargar", server="kbagi")) - usuario = scrapertools.find_single_match(item.url, '%s/([^/]+)/' % item.extra) - url_usuario = item.extra + "/" + usuario - if item.folderurl and not item.folderurl.startswith(item.extra): - item.folderurl = item.extra + item.folderurl - if item.post: - itemlist.append(item.clone(action="listado", title="Ver colección: %s" % item.foldername, - url=item.folderurl + "/gallery,1,1?ref=pager", post="")) - data = httptools.downloadpage(item.folderurl).data - token = scrapertools.find_single_match(data, - 'data-action="followChanged.*?name="__RequestVerificationToken".*?value="([^"]+)"') - collection_id = item.folderurl.rsplit("-", 1)[1] - post = "__RequestVerificationToken=%s&collectionId=%s" % (token, collection_id) - url = "%s/action/Follow/Follow" % item.extra - title = "Seguir Colección: %s" % item.foldername - if "dejar de seguir" in data: - title = "Dejar de seguir la colección: %s" % item.foldername - url = "%s/action/Follow/UnFollow" % item.extra - itemlist.append(item.clone(action="seguir", title=title, url=url, post=post, text_color=color5, folder=False)) - itemlist.append( - item.clone(action="colecciones", title="Ver colecciones del usuario: %s" % usuario, url=url_usuario)) - return itemlist - - -def colecciones(item): - logger.info() - itemlist = [] - usuario = False - data = httptools.downloadpage(item.url).data - if "Ver colecciones del usuario" not in item.title and not item.index: - data = jsontools.load(data)["Data"] - content = data["Content"] - content = re.sub(r"\n|\r|\t|\s{2}| |
    ", "", content) - else: - usuario = True - if item.follow: - content = scrapertools.find_single_match(data, - 'id="followed_collections"(.*?)