diff --git a/mediaserver/HTTPAndWSServer.py b/mediaserver/HTTPAndWSServer.py index 04529a28..8786a8e7 100644 --- a/mediaserver/HTTPAndWSServer.py +++ b/mediaserver/HTTPAndWSServer.py @@ -1,10 +1,12 @@ # -*- coding: utf-8 -*- +import os import random import re import threading import time import traceback +from platformcode import platformtools from BaseHTTPServer import HTTPServer from HTTPWebSocketsHandler import HTTPWebSocketsHandler diff --git a/mediaserver/alfa.py b/mediaserver/alfa.py index e53fe499..f61ab910 100644 --- a/mediaserver/alfa.py +++ b/mediaserver/alfa.py @@ -8,6 +8,8 @@ import sys import threading import time from functools import wraps +# Requerido para el ejecutable en windows +import SimpleHTTPServer sys.dont_write_bytecode = True from platformcode import config diff --git a/mediaserver/genera.bat b/mediaserver/genera.bat new file mode 100644 index 00000000..648884ce --- /dev/null +++ b/mediaserver/genera.bat @@ -0,0 +1,5 @@ +REM Genera los archivos para el ejecutable en windows de Alfa Mediaserver +python setup.py py2exe -p channels,servers,lib,platformcode +xcopy lib dist\lib /y /s /i +xcopy platformcode dist\platformcode /y /s /i +xcopy resources dist\resources /y /s /i diff --git a/mediaserver/platformcode/config.py b/mediaserver/platformcode/config.py index e8b82980..042271fe 100644 --- a/mediaserver/platformcode/config.py +++ b/mediaserver/platformcode/config.py @@ -14,7 +14,7 @@ settings_dic = {} adult_setting = {} -def get_addon_version(linea_inicio=0, total_lineas=2): +def get_addon_version(linea_inicio=0, total_lineas=2, with_fix=False): ''' Devuelve el número de de versión del addon, obtenido desde el archivo addon.xml ''' @@ -271,6 +271,14 @@ def get_localized_string(code): return dev +def get_localized_category(categ): + categories = {'movie': get_localized_string(30122), 'tvshow': get_localized_string(30123), + 'anime': get_localized_string(30124), 'documentary': get_localized_string(30125), + 'vos': get_localized_string(30136), 'adult': get_localized_string(30126), + 'direct': get_localized_string(30137), 'torrent': get_localized_string(70015)} + return categories[categ] if categ in categories else categ + + def get_videolibrary_path(): value = get_setting("videolibrarypath") if value == "": diff --git a/mediaserver/platformcode/controllers/__init__.py b/mediaserver/platformcode/controllers/__init__.py index bc031b42..41b7e8ae 100644 --- a/mediaserver/platformcode/controllers/__init__.py +++ b/mediaserver/platformcode/controllers/__init__.py @@ -7,12 +7,12 @@ import os from inspect import isclass from controller import Controller -from platformcode import logger +from platformcode import config, logger def load_controllers(): controllers = [] - path = os.path.split(__file__)[0] + path = os.path.join(config.get_runtime_path(),"platformcode\controllers") for fname in os.listdir(path): mod, ext = os.path.splitext(fname) fname = os.path.join(path, fname) diff --git a/mediaserver/setup.py b/mediaserver/setup.py new file mode 100644 index 00000000..34d9a062 --- /dev/null +++ b/mediaserver/setup.py @@ -0,0 +1,18 @@ +# setup.py +# Para crear el ejecutable de Alfa mediaserver en windows +# Se usa py2exe +# Linea de comandos para la creacion: python setup.py py2exe -p channels,servers,lib,platformcode +from distutils.core import setup +import glob +import py2exe + +setup(packages=['channels','servers','lib','platformcode','platformcode/controllers'], + data_files=[("channels",glob.glob("channels\\*.py")), + ("channels",glob.glob("channels\\*.json")), + ("servers",glob.glob("servers\\*.py")), + ("servers",glob.glob("servers\\*.json")), + ("",glob.glob("addon.xml")), + ], + console=["alfa.py"] + ) + diff --git a/plugin.video.alfa/addon.xml b/plugin.video.alfa/addon.xml index da32f019..37d3ce29 100755 --- a/plugin.video.alfa/addon.xml +++ b/plugin.video.alfa/addon.xml @@ -1,5 +1,5 @@ - + @@ -19,12 +19,12 @@ [B]Estos son los cambios para esta versión:[/B] [COLOR green][B]Canales agregados y arreglos[/B][/COLOR] - ¤ dospelis ¤ goodpelis - ¤ pelisr ¤ sonpelis - ¤ jawcloud ¤ estream - ¤ pelisplusco ¤ hdfull - ¤ cinemahd - + ¤ elitetorrent ¤ grantorrent + ¤ newpct1 ¤ seriesanimadas + ¤ seriesblanco ¤ rapidvideo + ¤ watchvideo ¤ pelispedia + ¤ beeg + ¤ arreglos internos ¤ Agradecimientos a @angedam por colaborar en ésta versión diff --git a/plugin.video.alfa/channels/alltorrent.json b/plugin.video.alfa/channels/alltorrent.json deleted file mode 100755 index ae9bbebe..00000000 --- a/plugin.video.alfa/channels/alltorrent.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "id": "alltorrent", - "name": "Alltorrent", - "active": false, - "adult": false, - "language": ["cast"], - "thumbnail": "altorrent.png", - "fanart": "altorrent.jpg", - "categories": [ - "torrent", - "movie" - ], - "settings": [ - { - "id": "modo_grafico", - "type": "bool", - "label": "Buscar información extra", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "include_in_global_search", - "type": "bool", - "label": "Incluir en busqueda global", - "default": false, - "enabled": true, - "visible": true - }, - { - "id": "include_in_newest_torrent", - "type": "bool", - "label": "Incluir en Novedades - Torrent", - "default": true, - "enabled": true, - "visible": true - } - ] -} \ No newline at end of file diff --git a/plugin.video.alfa/channels/alltorrent.py b/plugin.video.alfa/channels/alltorrent.py deleted file mode 100755 index 2f9ec7cd..00000000 --- a/plugin.video.alfa/channels/alltorrent.py +++ /dev/null @@ -1,314 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -import sys -import urllib -import urlparse - -from channelselector import get_thumb -from core import httptools -from core import scrapertools -from core import servertools -from core.item import Item -from platformcode import config, logger -from core import tmdb -from lib import generictools - -host = 'http://alltorrent.net/' -__modo_grafico__ = config.get_setting('modo_grafico', 'alltorrent') - - -def mainlist(item): - logger.info() - itemlist = [] - - thumb_pelis = get_thumb("channels_movie.png") - thumb_pelis_hd = get_thumb("channels_movie_hd.png") - thumb_series = get_thumb("channels_tvshow.png") - thumb_series_hd = get_thumb("channels_tvshow_hd.png") - thumb_buscar = get_thumb("search.png") - - itemlist.append(item.clone(title="[COLOR springgreen][B]Todas Las Películas[/B][/COLOR]", action="listado", - url=host, thumbnail=thumb_pelis, extra="pelicula")) - itemlist.append(item.clone(title="[COLOR springgreen] Incluyen 1080p[/COLOR]", action="listado", - url=host + "rezolucia/1080p/", thumbnail=thumb_pelis_hd, extra="pelicula")) - itemlist.append(item.clone(title="[COLOR springgreen] Incluyen 720p[/COLOR]", action="listado", - url=host + "rezolucia/720p/", thumbnail=thumb_pelis_hd, extra="pelicula")) - itemlist.append(item.clone(title="[COLOR springgreen] Incluyen Hdrip[/COLOR]", action="listado", - url=host + "rezolucia/hdrip/", thumbnail=thumb_pelis, extra="pelicula")) - itemlist.append(item.clone(title="[COLOR springgreen] Incluyen 3D[/COLOR]", action="listado", - url=host + "rezolucia/3d/", thumbnail=thumb_pelis_hd, extra="pelicula")) - itemlist.append(item.clone(title="[COLOR floralwhite][B]Buscar[/B][/COLOR]", action="search", thumbnail=thumb_buscar, - extra="titulo")) - itemlist.append(item.clone(title="[COLOR oldlace] Por Título[/COLOR]", action="search", thumbnail=thumb_buscar, - extra="titulo")) - itemlist.append(item.clone(title="[COLOR oldlace] Por Año[/COLOR]", action="search", thumbnail=thumb_buscar, - extra="año")) - itemlist.append(item.clone(title="[COLOR oldlace] Por Rating Imdb[/COLOR]", action="search", thumbnail=thumb_buscar, - extra="rating")) - - return itemlist - - -def listado(item): - logger.info() - itemlist = [] - - # Descarga la página - data = '' - try: - data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) - except: - pass - - if not data and item.extra != "año": #Si la web está caída salimos sin dar error - logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) - itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - elif not data and item.extra == "año": #cuando no hay datos para un año, da error. Tratamos de evitar el error - return itemlist - - patron = '
([^"]+)<\/a>\s?<\/div>
(.*?)<\/div><\/div><\/div>' - #data = scrapertools.find_single_match(data, patron) - matches = re.compile(patron, re.DOTALL).findall(data) - if not matches and not '') + elif item.cat == 'year': + data = scrapertools.find_single_match(data, 'Año.*?') + elif item.cat == 'quality': + data = scrapertools.find_single_match(data, 'Calidad.*?') + + patron = "
  • ([^<]+)" + + matches = re.compile(patron, re.DOTALL).findall(data) + for scrapedtitle, scrapedurl in matches: if scrapedtitle != 'Próximas Películas': - itemlist.append(item.clone(action='lista', title=scrapedtitle, url=host+scrapedurl)) + itemlist.append(item.clone(action='lista', title=scrapedtitle, url=host+scrapedurl, type='cat', first=0)) + return itemlist +def search_results(item): + logger.info() + itemlist = [] + + data = httptools.downloadpage(item.url).data + data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) + + patron = '([^<]+).*?class="poster-bg" src="([^"]+)"/>.*?

    .*?' + patron +=">(\d{4}).*?

    ([^<]+) 0: - itemlist.append(Item(channel=item.channel, title="[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]", url=item.url, - action="add_serie_to_library", extra="episodios", show=item.show)) + itemlist.append(Item(channel=item.channel, title="[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]", + url=item.url, action="add_serie_to_library", extra="episodios", + contentSerieName=item.contentSerieName)) return itemlist -def bitly(item): - logger.info() - itemlist = list() - data = httptools.downloadpage(item.url).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '.*?
    .*?") + + patron = '.*?
    (\d{4})
    ' + patron += '
    (.*?)
    ([^<]+)
    ' + matches = scrapertools.find_multiple_matches(data, patron) - for scrapedtype,scrapedquality,scrapedthumbnail,scrapedtitle,scrapedyear,scrapedurl in matches: + + first = int(item.first) + last = first + 19 + if last > len(matches): + last = len(matches) + next = False + + + for scrapedtype, scrapedyear, scrapedthumbnail, scrapedquality, scrapedtitle ,scrapedurl in matches[first:last]: patron_quality="(.+?)" quality = scrapertools.find_multiple_matches(scrapedquality, patron_quality) qual="" + for calidad in quality: qual=qual+"["+calidad+"] " + title="%s [%s] %s" % (scrapedtitle,scrapedyear,qual) - if item.title =="Series": - itemlist.append(item.clone(title=title, url=host+scrapedurl, extra=scrapedtitle, plot=scrapedtitle, - show=scrapedtitle, thumbnail=scrapedthumbnail, contentType="serie", action="capitulos")) - elif scrapedtype != 'serie': - itemlist.append( - item.clone(title=title, url=host+scrapedurl, action="findvideos", extra=scrapedtype, plot=scrapedtitle, - show=scrapedtitle, thumbnail=scrapedthumbnail, contentType="movie", context=["buscar_trailer"])) + new_item= Item(channel=item.channel, title=title, url=host+scrapedurl, thumbnail=scrapedthumbnail, + type=scrapedtype, infoLabels={'year':scrapedyear}) + if scrapedtype.strip() == 'sr': + new_item.contentSerieName = scrapedtitle + new_item.action = 'episodios' + else: + new_item.contentTitle = scrapedtitle + new_item.action = 'findvideos' - # Paginacion - patron_genero = '

    ([^"]+)<\/h1>' - genero = scrapertools.find_single_match(data, patron_genero) - if genero == "Romance" or genero == "Drama": - patron = "') + g_url = '%s%s' % ('https://drive.google.com', video_id) + g_url = g_url.replace('&', '&') + g_data = httptools.downloadpage(g_url, follow_redirects=False, only_headers=True).headers + url = g_data['location'] + dl_links.append(Item(channel=item.channel, title='%s', url=url, action='play', infoLabels=item.infoLabels)) + + if item.type == 'pl': + new_url = scrapertools.find_single_match(data, '
    .*? 0: @@ -293,12 +304,12 @@ def start(itemlist, item): # Verifica si el item viene de la videoteca try: - if item.contentChannel =='videolibrary': + if base_item.contentChannel =='videolibrary': # Marca como visto from platformcode import xbmc_videolibrary - xbmc_videolibrary.mark_auto_as_watched(item) + xbmc_videolibrary.mark_auto_as_watched(base_item) # Rellena el video con los datos del item principal y reproduce - play_item = item.clone(url=videoitem) + play_item = base_item.clone(url=videoitem) platformtools.play_video(play_item.url, autoplay=True) else: # Si no viene de la videoteca solo reproduce @@ -308,7 +319,7 @@ def start(itemlist, item): try: if platformtools.is_playing(): - played = True + PLAYED = True break except: logger.debug(str(len(autoplay_list))) @@ -340,7 +351,6 @@ def start(itemlist, item): if user_config_setting_player != 0: config.set_setting("player_mode", user_config_setting_player) - # devuelve la lista de enlaces para la eleccion manual return itemlist @@ -516,7 +526,7 @@ def autoplay_config(item): default = num - 1 if default > len(server_list) - 1: default = 0 - set_servers = {"id": "server_%s" % num, "label": u" \u2665 " +"Servidor Favorito %s" % num, + set_servers = {"id": "server_%s" % num, "label": u" \u2665 Servidor Favorito %s" % num, "color": "0xfffcab14", "type": "list", "default": default, "enabled": "eq(-%s,true)+eq(-%s,true)" % (pos1, num), "visible": True, "lvalues": server_list} @@ -548,7 +558,7 @@ def autoplay_config(item): if default > len(quality_list) - 1: default = 0 - set_quality = {"id": "quality_%s" % num, "label": u" \u2665 " + "Calidad Favorita %s" % num, + set_quality = {"id": "quality_%s" % num, "label": u" \u2665 Calidad Favorita %s" % num, "color": "0xfff442d9", "type": "list", "default": default, "enabled": "eq(-%s,true)+eq(-%s,true)" % (pos1, num), "visible": True, "lvalues": quality_list} @@ -633,7 +643,7 @@ def get_languages(channel): return list_language -def is_active(): +def is_active(channel): ''' Devuelve un booleano q indica si esta activo o no autoplay en el canal desde el que se llama @@ -650,17 +660,17 @@ def is_active(): autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY') # Obtine el canal desde el q se hace la llamada - import inspect - module = inspect.getmodule(inspect.currentframe().f_back) - canal = module.__name__.split('.')[1] - logger.debug(canal) + #import inspect + #module = inspect.getmodule(inspect.currentframe().f_back) + #canal = module.__name__.split('.')[1] + canal = channel - # Obtiene el nodo del canal desde autoplay_node - channel_node = autoplay_node.get(canal, {}) - # Obtiene los ajustes des autoplay para este canal - settings_node = channel_node.get('settings', {}) + # Obtiene el nodo del canal desde autoplay_node + channel_node = autoplay_node.get(canal, {}) + # Obtiene los ajustes des autoplay para este canal + settings_node = channel_node.get('settings', {}) - return settings_node.get('active', False) + return settings_node.get('active', False) def reset(item, dict): @@ -674,3 +684,34 @@ def reset(item, dict): platformtools.dialog_notification('AutoPlay', '%s: Los datos fueron reiniciados' % item.category) return + +def set_status(status): + logger.info() + # Obtiene el nodo AUTOPLAY desde el json + autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY') + autoplay_node['status'] = status + + result, json_data = jsontools.update_node(autoplay_node, 'autoplay', 'AUTOPLAY') + +def play_multi_channel(item, itemlist): + logger.info() + global PLAYED + actual_channel = '' + channel_videos = [] + video_dict = dict() + set_status(True) + for video_item in itemlist: + if video_item.contentChannel != actual_channel: + actual_channel = video_item.contentChannel + else: + channel_videos.append(video_item) + video_dict[actual_channel] = channel_videos + + for channel, videos in video_dict.items(): + if not PLAYED: + item.contentChannel = channel + if is_active(channel): + logger.debug('esta activo en %s' % channel) + start(videos, item) + else: + break diff --git a/plugin.video.alfa/channels/beeg.py b/plugin.video.alfa/channels/beeg.py index 09fdafe1..f3b68b14 100755 --- a/plugin.video.alfa/channels/beeg.py +++ b/plugin.video.alfa/channels/beeg.py @@ -53,8 +53,8 @@ def mainlist(item): itemlist = [] itemlist.append(Item(channel=item.channel, action="videos", title="Útimos videos", url=url_api + "/index/main/0/pc", viewmode="movie")) - itemlist.append(Item(channel=item.channel, action="listcategorias", title="Listado categorias Populares", - url=url_api + "/index/main/0/pc", extra="popular")) + #itemlist.append(Item(channel=item.channel, action="listcategorias", title="Listado categorias Populares", + # url=url_api + "/index/main/0/pc", extra="popular")) itemlist.append(Item(channel=item.channel, action="listcategorias", title="Listado categorias completo", url=url_api + "/index/main/0/pc", extra="nonpopular")) itemlist.append( @@ -74,7 +74,7 @@ def videos(item): title = Video["title"] itemlist.append( Item(channel=item.channel, action="play", title=title, url=url, thumbnail=thumbnail, plot="", show="", - folder=True)) + folder=True, contentType="movie")) # Paginador Actual = int(scrapertools.get_match(item.url, url_api + '/index/[^/]+/([0-9]+)/pc')) @@ -93,10 +93,11 @@ def listcategorias(item): data = scrapertools.cache_page(item.url) JSONData = json.load(data) - for Tag in JSONData["tags"][item.extra]: - url = url_api + "/index/tag/0/pc?tag=" + Tag - title = Tag - title = title[:1].upper() + title[1:] + #for Tag in JSONData["tags"][item.extra]: + for Tag in JSONData["tags"]: + url = url_api + "/index/tag/0/pc?tag=" + Tag["tag"] + title = '%s - %s' % (str(Tag["tag"]), str(Tag["videos"])) + #title = title[:1].upper() + title[1:] itemlist.append( Item(channel=item.channel, action="videos", title=title, url=url, folder=True, viewmode="movie")) @@ -108,6 +109,7 @@ def search(item, texto): texto = texto.replace(" ", "+") item.url = item.url % (texto) + try: return videos(item) # Se captura la excepción, para no interrumpir al buscador global si un canal falla diff --git a/plugin.video.alfa/channels/elitetorrent.py b/plugin.video.alfa/channels/elitetorrent.py index fccba66c..c4b74f07 100644 --- a/plugin.video.alfa/channels/elitetorrent.py +++ b/plugin.video.alfa/channels/elitetorrent.py @@ -274,8 +274,6 @@ def findvideos(item): item.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]s\]', '', item.title) #Quitamos size de título, si lo traía item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título item.quality = re.sub('\s\[\d+,?\d*?\s\w[b|B]s\]', '', item.quality) #Quitamos size de calidad, si lo traía - item.quality = '%s [%s]' % (item.quality, size) #Agregamos size al final de calidad - item.quality = item.quality.replace("G", "G ").replace("M", "M ") #Se evita la palabra reservada en Unify patron_t = '
    ').replace('name="q"', "") - matches = scrapertools.find_multiple_matches(bloque, 'name="([^"]+).*?value="([^"]+)') - post = "q=" + texto + "&" - for name, value in matches: - post += name + "=" + value + "&" - data = httptools.downloadpage(url_cse + post).data - cse_token = scrapertools.find_single_match(data, "var cse_token='([^']+)'") + cxv = scrapertools.find_single_match(data, 'cx" value="([^"]+)"') + data = httptools.downloadpage("https://cse.google.es/cse.js?hpg=1&cx=%s" %cxv).data + cse_token = scrapertools.find_single_match(data, 'cse_token": "([^"]+)"') item.url = host_search %(texto, cse_token) try: return sub_search(item) @@ -99,7 +94,8 @@ def generos(item): action = 'peliculas', title = title, url = url, - viewmode = "movie")) + viewmode = "movie", + first=0)) itemlist = sorted(itemlist, key=lambda item: item.title) return itemlist @@ -107,11 +103,18 @@ def generos(item): def peliculas(item): logger.info() itemlist = [] + next = True data = httptools.downloadpage(item.url).data patron = '([^<]+) len(matches): + last = len(matches) + next = False + + for scrapedurl, scrapedtitle, scrapedthumbnail, resto in matches[first:last]: language = [] plot = scrapertools.htmlclean(resto).strip() languages = scrapertools.find_multiple_matches(plot, r'\((V.)\)') @@ -132,6 +135,13 @@ def peliculas(item): language=language, quality=quality )) + #paginacion + + url_next_page = item.url + first = last + if next: + itemlist.append(item.clone(title="Siguiente >>", url=url_next_page, action='peliculas', first=first)) + return itemlist @@ -149,7 +159,7 @@ def findvideos(item): cuenta = 0 for datos in bloque: cuenta = cuenta + 1 - patron = '(opción %s.*?)' %cuenta + patron = '((?:opción|opción) %s.*?)' %cuenta scrapedopcion = scrapertools.find_single_match(data, patron) titulo_opcion = "(" + scrapertools.find_single_match(scrapedopcion, "op.*?, (.*)").upper() + ")" if "TRAILER" in titulo_opcion or titulo_opcion == "()": diff --git a/plugin.video.alfa/channels/grantorrent.py b/plugin.video.alfa/channels/grantorrent.py index 4ecf072a..e79df7bf 100644 --- a/plugin.video.alfa/channels/grantorrent.py +++ b/plugin.video.alfa/channels/grantorrent.py @@ -460,10 +460,18 @@ def findvideos(item): item_local.quality = quality + tiempo if "temporada" in temp_epi.lower(): item_local.quality = '%s [Temporada]' % item_local.quality + #Añadimos la duración, que estará en item.quility + if scrapertools.find_single_match(item.quality, '(\[\d+:\d+)'): #si ya tiene la duración, la ponemos + item_local.quality = '%s [%s h]' % (item_local.quality, scrapertools.find_single_match(item.quality, '(\d+:\d+)')) #if size and item_local.contentType != "episode": if size: size = size.replace(".", ",").replace("B,", " B").replace("b,", " b") item_local.quality = '%s [%s]' % (item_local.quality, size) + if item_local.action == 'show_result': #Viene de una búsqueda global + channel = item_local.channel.capitalize() + if item_local.from_channel: + channel = item_local.from_channel.capitalize() + item_local.quality = '[COLOR yellow][%s][/COLOR] %s' % (channel, item_local.quality) #Salvamos la url del .torrent if scrapedurl: diff --git a/plugin.video.alfa/channels/infoplus.py b/plugin.video.alfa/channels/infoplus.py index ee738c03..0f2f8bfe 100755 --- a/plugin.video.alfa/channels/infoplus.py +++ b/plugin.video.alfa/channels/infoplus.py @@ -37,9 +37,9 @@ ACTION_MOVE_UP = 3 set_animation = False xinfoplus_set = config.get_setting("infoplus_set") -if xinfoplus_set == "Sin animación": +if xinfoplus_set == config.get_localized_string(70129): set_animation = False -if xinfoplus_set == "Con animación": +if xinfoplus_set == config.get_localized_string(70130): set_animation = True def start(item, recomendaciones=[], from_window=False): @@ -400,7 +400,7 @@ class main(xbmcgui.WindowDialog): self.plot.autoScroll(11000, 6000, 30000) except: xbmc.executebuiltin( - 'Notification([COLOR red][B]Actualiza Kodi a su última versión[/B][/COLOR], [COLOR skyblue]para mejor info[/COLOR],8000, "http://i.imgur.com/mHgwcn3.png")') + config.get_localized_string(70500)) self.plot.setText(dhe(self.infoLabels.get("plot", ""))) xbmc.sleep(200) @@ -842,7 +842,7 @@ class related(xbmcgui.WindowDialog): self.info_peli.autoScroll(7000, 6000, 30000) except: xbmc.executebuiltin( - 'Notification([COLOR red][B]Actualiza Kodi a su última versión[/B][/COLOR], [COLOR skyblue]para mejor info[/COLOR],8000, "http://i.imgur.com/mHgwcn3.png")') + config.get_localized_string(70500)) self.info_peli.setText(self.info) if set_animation: self.info_peli.setAnimations( @@ -859,9 +859,9 @@ class related(xbmcgui.WindowDialog): ('WindowClose', 'effect=zoom end=0% time=1000 condition=true',)]) if self.infoLabels.get("status") == "Ended" and self.item.contentType != "movie": - status = "[COLOR aquamarine][B]Finalizada %s[/B][/COLOR]" + status = config.get_localized_string(70515) elif self.infoLabels.get("status") and self.item.contentType != "movie": - status = "[COLOR aquamarine][B]En emisión %s[/B][/COLOR]" + status = config.get_localized_string(70516) else: status = "[COLOR aquamarine][B]%s[/B][/COLOR]" @@ -891,7 +891,7 @@ class related(xbmcgui.WindowDialog): self.gt_peli = xbmcgui.ControlTextBox(210, 385, 1100, 60, self.fonts["12"]) self.addControl(self.gt_peli) - self.gt_peli.setText("[COLOR limegreen][B]Género: [/B][/COLOR]") + self.gt_peli.setText("[COLOR limegreen][B]%s[/B][/COLOR]" % config.get_localized_string(70499)) if set_animation: self.gt_peli.setAnimations( [('conditional', 'effect=slide start=0,-7000 delay=5750 time=700 condition=true tween=circle easing=in',), @@ -907,7 +907,7 @@ class related(xbmcgui.WindowDialog): self.pt_peli = xbmcgui.ControlTextBox(210, 410, 307, 60, self.fonts["12"]) self.addControl(self.pt_peli) - self.pt_peli.setText("[COLOR limegreen][B]Productora: [/B][/COLOR]") + self.pt_peli.setText("[COLOR limegreen][B]%s[/B][/COLOR]" % config.get_localized_string(70498)) if set_animation: self.pt_peli.setAnimations( [('conditional', 'effect=slide start=0,-7000 delay=5700 time=700 condition=true tween=circle easing=in',), @@ -1238,7 +1238,7 @@ class Busqueda(xbmcgui.WindowXMLDialog): else: self.getControl(1).setLabel(config.get_localized_string(60494)) - self.getControl(5).setLabel("[COLOR tomato][B]Cerrar[/B][/COLOR]") + self.getControl(5).setLabel(config.get_localized_string(60495)) self.control_list.reset() items = [] for item_l in self.lista: @@ -1577,7 +1577,7 @@ class ActorInfo(xbmcgui.WindowDialog): self.info_actor.autoScroll(7000, 6000, 30000) except: xbmc.executebuiltin( - 'Notification([COLOR red][B]Actualiza Kodi a su última versión[/B][/COLOR], [COLOR skyblue]para mejor info[/COLOR],8000, "http://i.imgur.com/mHgwcn3.png")') + config.get_localized_string(70500)) self.info_actor.setText( "[COLOR coral][B]%s[/B][/COLOR]" % actor_tmdb.result.get("biography", config.get_localized_string(60504))) @@ -1601,7 +1601,7 @@ class ActorInfo(xbmcgui.WindowDialog): else: self.titulos.append([entradas["id"], entradas.get("title", entradas.get("original_title", "")), thumb]) - self.dialog.update(40, '[COLOR rosybrown]Obteniendo filmografía...[/COLOR]') + self.dialog.update(40, config.get_localized_string(60505)) self.mas_pelis = 8 self.idps = [] self.botones = [] @@ -1673,7 +1673,7 @@ class ActorInfo(xbmcgui.WindowDialog): self.botones.append(self.btn_right) xbmc.sleep(200) - self.dialog.update(80, '[COLOR plum]Recopilando imágenes...[/COLOR]') + self.dialog.update(80, config.get_localized_string(60506)) self.images = [] for images in actor_tmdb.result.get("images", {}).get("profiles", []): imagen = "https://image.tmdb.org/t/p/original" + images["file_path"] diff --git a/plugin.video.alfa/channels/locopelis.py b/plugin.video.alfa/channels/locopelis.py index d22648dc..7173701f 100755 --- a/plugin.video.alfa/channels/locopelis.py +++ b/plugin.video.alfa/channels/locopelis.py @@ -252,10 +252,8 @@ def ultimas(item): itemlist = [] data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t| |
    ", "", data) - data = data.decode('cp1252') realplot = '' - patron = '
    .*?<\/a>' + patron = ' ", "", data) - data = data.decode('cp1252') - data = scrapertools.find_single_match(data, '<\/form><\/table><\/div>.*?<\/ul>') - - patron = '
  • (.*?)<\/a><\/li>' + patron = '
  • ([^<]+)<\/a><\/li>' matches = re.compile(patron, re.DOTALL).findall(data) for scrapedurl, scrapedtitle in matches: @@ -356,36 +351,40 @@ def findvideos(item): logger.info() itemlist = [] - new_url = get_link(get_source(item.url)) - new_url = get_link(get_source(new_url)) - video_id = scrapertools.find_single_match(new_url, 'http.*?h=(\w+)') - new_url = '%s%s' % (host, 'playeropstream/api.php') - post = {'h': video_id} - post = urllib.urlencode(post) - data = httptools.downloadpage(new_url, post=post).data - json_data = jsontools.load(data) - url = json_data['url'] - server = servertools.get_server_from_url(url) - title = '%s [%s]' % (server, item.language) - itemlist.append(Item(channel=item.channel, title=title, url=url, action='play', language=item.language, - server=server, infoLabels=item.infoLabels)) + try: + new_url = get_link(get_source(item.url)) + new_url = get_link(get_source(new_url)) + video_id = scrapertools.find_single_match(new_url, 'http.*?h=(\w+)') + new_url = '%s%s' % (host, 'playeropstream/api.php') + post = {'h': video_id} + post = urllib.urlencode(post) + data = httptools.downloadpage(new_url, post=post).data + json_data = jsontools.load(data) + url = json_data['url'] + server = servertools.get_server_from_url(url) + title = '%s [%s]' % (server, item.language) + itemlist.append(Item(channel=item.channel, title=title, url=url, action='play', language=item.language, + server=server, infoLabels=item.infoLabels)) - # Requerido para FilterTools + # Requerido para FilterTools - itemlist = filtertools.get_links(itemlist, item, list_language) + itemlist = filtertools.get_links(itemlist, item, list_language) - # Requerido para AutoPlay + # Requerido para AutoPlay - autoplay.start(itemlist, item) + 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 + )) + except: + pass - 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 diff --git a/plugin.video.alfa/channels/newpct1.json b/plugin.video.alfa/channels/newpct1.json index cff73741..c01d3a25 100644 --- a/plugin.video.alfa/channels/newpct1.json +++ b/plugin.video.alfa/channels/newpct1.json @@ -41,8 +41,8 @@ "visible": true, "lvalues": [ "Torrentrapid", - "Torrentlocura", "Tumejortorrent", + "Torrentlocura", "Tvsinpagar", "Descargas2020", "Mispelisyseries" @@ -52,7 +52,7 @@ "id": "clonenewpct1_channels_list", "type": "text", "label": "Lista de clones de NewPct1 y orden de uso", - "default": "('1', 'torrentrapid', 'http://torrentrapid.com/', 'movie, tvshow, season, episode', 'serie_episodios'), ('1', 'torrentlocura', 'http://torrentlocura.com/', 'movie, tvshow, season, episode', ''), ('1', 'tumejortorrent', 'http://tumejortorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'tvsinpagar', 'http://www.tvsinpagar.com/', 'tvshow, season, episode', ''), ('1', 'descargas2020', 'http://descargas2020.com/', 'movie, tvshow, season, episode', ''), ('1', 'mispelisyseries', 'http://mispelisyseries.com/', 'movie', 'search, listado_busqueda')", + "default": "('1', 'torrentrapid', 'http://torrentrapid.com/', 'movie, tvshow, season, episode', 'serie_episodios'), ('1', 'tumejortorrent', 'http://tumejortorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentlocura', 'http://torrentlocura.com/', 'movie, tvshow, season, episode', ''), ('1', 'tvsinpagar', 'http://www.tvsinpagar.com/', 'tvshow, season, episode', ''), ('1', 'descargas2020', 'http://descargas2020.com/', 'movie, tvshow, season, episode', ''), ('1', 'mispelisyseries', 'http://mispelisyseries.com/', 'movie', 'search, listado_busqueda')", "enabled": true, "visible": false }, diff --git a/plugin.video.alfa/channels/newpct1.py b/plugin.video.alfa/channels/newpct1.py index 3da3f9d4..ed7d1ed5 100644 --- a/plugin.video.alfa/channels/newpct1.py +++ b/plugin.video.alfa/channels/newpct1.py @@ -373,6 +373,7 @@ def listado(item): elif item.extra == "series" and not "/miniseries" in item.url: item.action = "episodios" item.contentType = "tvshow" + item.season_colapse = True pag = True elif item.extra == "varios" or "/miniseries" in item.url: item.action = "findvideos" @@ -604,8 +605,10 @@ def listado(item): if item_local.contentType == "movie": year = scrapertools.find_single_match(scrapedurl, r'(\d{4})') if year >= "1900" and year <= "2040" and year != "2020": - title_subs += [year] - item_local.infoLabels['year'] = '-' + item_local.infoLabels['year'] = year + #title_subs += [year] + else: + item_local.infoLabels['year'] = '-' #Guarda la variable temporal que almacena la info adicional del título a ser restaurada después de TMDB item_local.title_subs = title_subs @@ -827,7 +830,7 @@ def listado_busqueda(item): title_lista += [scrapedurl_alt] else: title_lista += [scrapedurl] - if "juego/" in scrapedurl or "xbox" in scrapedurl.lower() or "xbox" in scrapedtitle.lower() or "windows" in scrapedtitle.lower() or "windows" in calidad.lower() or "nintendo" in scrapedtitle.lower() or "xbox" in calidad.lower() or "epub" in calidad.lower() or "pdf" in calidad.lower() or "pcdvd" in calidad.lower() or "crack" in calidad.lower(): # no mostramos lo que no sean videos + if ("juego/" in scrapedurl or "xbox" in scrapedurl.lower()) and not "/serie" in scrapedurl or "xbox" in scrapedtitle.lower() or "windows" in scrapedtitle.lower() or "windows" in calidad.lower() or "nintendo" in scrapedtitle.lower() or "xbox" in calidad.lower() or "epub" in calidad.lower() or "pdf" in calidad.lower() or "pcdvd" in calidad.lower() or "crack" in calidad.lower(): # no mostramos lo que no sean videos continue cnt_title += 1 # Sería una línea real más para Itemlist @@ -863,7 +866,7 @@ def listado_busqueda(item): item_local.url = url item_local.extra2 = 'serie_episodios' #Creamos acción temporal excluyente para otros clones if item_local.category == 'Mispelisyseries': #Esta web no gestiona bien el cambio de episodio a Serie - pattern = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent + pattern = 'class="btn-torrent">.*?window.location.href = "([^"]+)";' #Patron para .torrent #Como no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el cambio de episodio por serie item_local, data_serie = generictools.fail_over_newpct1(item_local, pattern) else: @@ -872,7 +875,7 @@ def listado_busqueda(item): except: pass - pattern = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent + pattern = 'class="btn-torrent">.*?window.location.href = "([^"]+)";' #Patron para .torrent if not data_serie or (not scrapertools.find_single_match(data_serie, pattern) and not '

    ( 0 ) Resultados encontrados ' in data and not '

    • ' in data): logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item_local.url + " / DATA: " + data_serie) #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el cambio de episodio por serie @@ -892,7 +895,7 @@ def listado_busqueda(item): item_local.url = item_local.url.replace('/series/', '/series-vo/') #item_local.url = re.sub(r'\/\d+$', '/', item_local.url) #Quitamos el ID de la serie por compatib. if item_local.url: - title_subs += ["Episodio %sx%s" % (scrapertools.find_single_match(url, '\/temp.*?-(\d+)\/cap.*?-(\d+)\/'))] + title_subs += ["Episodio %sx%s" % (scrapertools.find_single_match(url, '\/temp.*?-(\d+)-?\/cap.*?-(\d+(?:-al-\d+)?)-?\/'))] url = item_local.url except: pass @@ -900,8 +903,8 @@ def listado_busqueda(item): if item.extra == "novedades" and "/serie" in url: if not item_local.url or episodio_serie == 0: item_local.url = url - if scrapertools.find_single_match(url, '\/temp.*?-(\d+)\/cap.*?-(\d+)\/'): - title_subs += ["Episodio %sx%s" % (scrapertools.find_single_match(url, '\/temp.*?-(\d+)\/cap.*?-(\d+)\/'))] + if scrapertools.find_single_match(url, '\/temp.*?-(\d+)-?\/cap.*?-(\d+(?:-al-\d+)?)-?\/'): + title_subs += ["Episodio %sx%s" % (scrapertools.find_single_match(url, '\/temp.*?-(\d+)-?\/cap.*?-(\d+(?:-al-\d+)?)-?\/'))] else: title_subs += ["Episodio 1x01"] @@ -909,6 +912,7 @@ def listado_busqueda(item): if (".com/serie" in url or "/serie" in url or "-serie" in url) and not "/miniseries" in url and (not "/capitulo" in url or "pelisyseries.com" in item_local.channel_host): #Series item_local.action = "episodios" item_local.contentType = "tvshow" + item_local.season_colapse = True item_local.extra = "series" elif "varios/" in url or "/miniseries" in url: #Documentales y varios item_local.action = "findvideos" @@ -963,6 +967,7 @@ def listado_busqueda(item): title = re.sub(r' - [t|T]emp\w+.*?\d+', '', title) title = re.sub(r' [t|T]emp.*?\d+[x|X]\d+', '', title) title = re.sub(r' [t|T]emp.*?\d+', '', title) + title = re.sub(r' [c|C]ap.*?\d+ al \d+', '', title) title = re.sub(r' [c|C]ap.*?\d+', '', title) if "audio" in title.lower(): #Reservamos info de audio para después de TMDB title_subs += ['[%s]' % scrapertools.find_single_match(title, r'(\[[a|A]udio.*?\])')] @@ -1071,8 +1076,10 @@ def listado_busqueda(item): year = "" year = str(year) if year >= "1900" and year <= "2040" and year != "2020": - title_subs += [year] - item_local.infoLabels['year'] = '-' + item_local.infoLabels['year'] = year + #title_subs += [year] + else: + item_local.infoLabels['year'] = '-' #Guarda la variable temporal que almacena la info adicional del título a ser restaurada después de TMDB item_local.title_subs = title_subs @@ -1531,24 +1538,40 @@ def episodios(item): item, data = generictools.fail_over_newpct1(item, verify_fo) #Limpiamos num. Temporada y Episodio que ha podido quedar por Novedades + season_display = 0 if item.contentSeason: + if item.season_colapse: #Si viene del menú de Temporadas... + season_display = item.contentSeason #... salvamos el num de sesión a pintar + item.from_num_season_colapse = season_display + del item.season_colapse + item.contentType = "tvshow" + if item.from_title_season_colapse: + item.title = item.from_title_season_colapse + del item.from_title_season_colapse + if item.infoLabels['title']: + del item.infoLabels['title'] del item.infoLabels['season'] if item.contentEpisodeNumber: del item.infoLabels['episode'] + if season_display == 0 and item.from_num_season_colapse: + season_display = item.from_num_season_colapse # Obtener la información actualizada de la Serie. TMDB es imprescindible para Videoteca if not item.infoLabels['tmdb_id']: - tmdb.set_infoLabels(item, True) + try: + tmdb.set_infoLabels(item, True) #TMDB de cada Temp + except: + pass modo_ultima_temp_alt = modo_ultima_temp - if item.ow_force == "1": #Si hay un traspaso de canal o url, se actualiza todo + if item.ow_force == "1": #Si hay un traspaso de canal o url, se actualiza todo modo_ultima_temp_alt = False max_temp = 1 if item.infoLabels['number_of_seasons']: max_temp = item.infoLabels['number_of_seasons'] y = [] - if modo_ultima_temp_alt and item.library_playcounts: #Averiguar cuantas temporadas hay en Videoteca + if modo_ultima_temp_alt and item.library_playcounts: #Averiguar cuantas temporadas hay en Videoteca patron = 'season (\d+)' matches = re.compile(patron, re.DOTALL).findall(str(item.library_playcounts)) for x in matches: @@ -1664,9 +1687,7 @@ def episodios(item): estado = True #Buena calidad de datos por defecto if "\d+)?)<.+?]+>(?P.*?)?<\/span>\s*Calidad\s*]+>" \ - "[\[]\s*(?P.*?)?\s*[\]]<\/span>" + pattern = "[^>]+>.*?Temporada\s*(?:]+>\[\s?)?(?P\d+)?.*?Capitulo(?:s)?\s*(?:]+>\[\s?)?(?P\d+)?(?:.*?(?P\d+)?)<.*?]+>(?P.*?)?<\/span>\s*Calidad\s*]+>[\[]\s*(?P.*?)?\s*[\]]<\/span>" if not scrapertools.find_single_match(info, pattern): if "especial" in info.lower(): # Capitulos Especiales pattern = ".*?[^>]+>.*?Temporada.*?\[.*?(?P\d+).*?\].*?Capitulo.*?\[\s*(?P\d+).*?\]?(?:.*?(?P\d+)?)<.+?]+>(?P.*?)?<\/span>\s*Calidad\s*]+>[\[]\s*(?P.*?)?\s*[\]]<\/span>" @@ -1768,11 +1789,19 @@ def episodios(item): break #Sale del bucle actual del FOR de episodios por página #if ('%sx%s' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2))) in item.library_playcounts: # continue - + + if season_display > 0: + if item_local.contentSeason > season_display: + continue + elif item_local.contentSeason < season_display: + break + if item_local.active: del item_local.active if item_local.contentTitle: del item_local.infoLabels['title'] + if item_local.season_colapse: + del item_local.season_colapse item_local.context = "['buscar_trailer']" item_local.action = "findvideos" item_local.contentType = "episode" @@ -1780,19 +1809,25 @@ def episodios(item): itemlist.append(item_local.clone()) + #logger.debug(item_local) + data = '' if len(itemlist) > 1: itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) #clasificamos + + if item.season_colapse and not item.add_videolibrary: #Si viene de listado, mostramos solo Temporadas + item, itemlist = generictools.post_tmdb_seasons(item, itemlist) - # Pasada por TMDB y clasificación de lista por temporada y episodio - tmdb.set_infoLabels(itemlist, True) + if not item.season_colapse: #Si no es pantalla de Temporadas, pintamos todo + # Pasada por TMDB y clasificación de lista por temporada y episodio + tmdb.set_infoLabels(itemlist, True) + + #Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB + item, itemlist = generictools.post_tmdb_episodios(item, itemlist) #logger.debug(item) - #Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB - item, itemlist = generictools.post_tmdb_episodios(item, itemlist) - return itemlist diff --git a/plugin.video.alfa/channels/peliculasrey.json b/plugin.video.alfa/channels/peliculasrey.json index 91c439fd..bd922f63 100755 --- a/plugin.video.alfa/channels/peliculasrey.json +++ b/plugin.video.alfa/channels/peliculasrey.json @@ -1,7 +1,7 @@ { "id": "peliculasrey", "name": "peliculasrey", - "active": true, + "active": false, "adult": false, "language": ["cast", "lat"], "thumbnail": "peliculasrey.png", diff --git a/plugin.video.alfa/channels/peliculasyseries.json b/plugin.video.alfa/channels/peliculasyseries.json new file mode 100644 index 00000000..fd0c878a --- /dev/null +++ b/plugin.video.alfa/channels/peliculasyseries.json @@ -0,0 +1,73 @@ +{ +"id": "peliculasyseries", + "name": "PeliculasySeries", + "active": true, + "adult": false, + "language": ["lat", "cast"], + "thumbnail": "https://s22.postimg.cc/xy1burkep/peliculasyseries.png", + "banner": "", + "categories": [ + "movie", + "tvshow", + "vos" + ], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "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", + "Latino", + "Castellano", + "VOSE", + "VOS", + "VO" + ] + }, + { + "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 + }, + { + "id": "comprueba_enlaces", + "type": "bool", + "label": "Verificar si los enlaces existen", + "default": false, + "enabled": true, + "visible": true + }, + { + "id": "comprueba_enlaces_num", + "type": "list", + "label": "Número de enlaces a verificar", + "default": 1, + "enabled": true, + "visible": "eq(-1,true)", + "lvalues": [ "5", "10", "15", "20" ] + } + ] +} diff --git a/plugin.video.alfa/channels/peliculasyseries.py b/plugin.video.alfa/channels/peliculasyseries.py new file mode 100644 index 00000000..ac83a4be --- /dev/null +++ b/plugin.video.alfa/channels/peliculasyseries.py @@ -0,0 +1,345 @@ +# -*- coding: utf-8 -*- +# -*- Channel PeliculasySeries -*- +# -*- Created for Alfa-addon -*- +# -*- By the Alfa Develop Group -*- + +import re +import urllib +import base64 + +from channelselector import get_thumb +from core import httptools +from core import jsontools +from core import scrapertools +from core import servertools +from core import tmdb +from lib import jsunpack +from core.item import Item +from channels import filtertools +from channels import autoplay +from platformcode import config, logger + + +IDIOMAS = {'la': 'Latino', 'lat':'Latino', 'cas':'Castellano','es': 'Castellano', 'vs': 'VOSE', 'vos':'VOSE', 'vo':'VO', + 'ori':'VO', 'so':'VOS', 'sor':'VOS'} +list_language = IDIOMAS.values() + +list_quality = ['TS','Screener','DVDRip','HDRip', 'HDTV', 'micro720', 'micro1080'] + +list_servers = ['openload', 'rapidvideo', 'powvideo', 'gamovideo', 'streamplay', 'flashx', 'clipwatching', 'vidoza', + 'thevideome'] + +__comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'peliculasyseries') +__comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'peliculasyseries') + +host = 'https://peliculasyseries.org/' + +def mainlist(item): + logger.info() + + autoplay.init(item.channel, list_servers, list_quality) + + itemlist = [] + + itemlist.append(Item(channel=item.channel, title='Peliculas', action='menu_movies', + thumbnail= get_thumb('movies', auto=True))) + itemlist.append(Item(channel=item.channel, title='Series', url=host+'series', action='list_all', type='tvshows', + thumbnail= get_thumb('tvshows', auto=True))) + itemlist.append( + item.clone(title="Buscar", action="search", url=host + 'buscar/q/', thumbnail=get_thumb("search", auto=True), + extra='movie')) + + itemlist = filtertools.show_option(itemlist, item.channel, list_language, list_quality) + autoplay.show_option(item.channel, itemlist) + + return itemlist + +def menu_movies(item): + logger.info() + + itemlist=[] + + itemlist.append(Item(channel=item.channel, title='Todas', url=host + 'movies', action='list_all', + thumbnail=get_thumb('all', auto=True), type='movies')) + itemlist.append(Item(channel=item.channel, title='Genero', action='section', + thumbnail=get_thumb('genres', auto=True), type='movies')) + + 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 get_language(lang_data): + logger.info() + language = [] + lang_data = lang_data.replace('language-ES', '').replace('medium', '').replace('serie', '').replace('-','') + if 'class' in lang_data: + lang_list = scrapertools.find_multiple_matches(lang_data, 'class=" ([^"]+)"') + else: + return lang_data.strip() + + for lang in lang_list: + if lang not in IDIOMAS: + lang = 'VOS' + if lang not in language: + language.append(IDIOMAS[lang]) + return language + +def section(item): + logger.info() + itemlist=[] + duplicados=[] + data = get_source(host) + data = scrapertools.find_single_match(data, 'data-toggle="dropdown">Géneros.*?multi-column-dropdown">.*?"clearfix"') + if 'Genero' in item.title: + patron = '
    • ([^<]+)' + + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, scrapedtitle in matches: + title = scrapedtitle + if title not in duplicados: + itemlist.append(Item(channel=item.channel, url=scrapedurl, title=title, action='list_all', + type=item.type)) + duplicados.append(title) + + return itemlist + + +def list_all(item): + logger.info() + itemlist = [] + + data = get_source(item.url) + if item.type == 'movies': + patron = '
      ' + patron += '»") + if url_next_page: + itemlist.append(item.clone(title="Siguiente >>", url=url_next_page, action='list_all')) + + return itemlist + +def seasons(item): + logger.info() + + itemlist=[] + + data=get_source(item.url) + patron='[^' + patron += '
      Temporada (\d+)
      ' + matches = re.compile(patron, re.DOTALL).findall(data) + + infoLabels = item.infoLabels + for scrapedurl, scrapedthumbnail, season in matches: + infoLabels['season']=season + title = 'Temporada %s' % season + itemlist.append(Item(channel=item.channel, title=title, url=scrapedurl, action='episodesxseasons', + thumbnail=scrapedthumbnail, infoLabels=infoLabels)) + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + if config.get_videolibrary_support() and len(itemlist) > 0: + itemlist.append( + Item(channel=item.channel, title='[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]', url=item.url, + action="add_serie_to_library", extra="episodios", contentSerieName=item.contentSerieName)) + + return itemlist + +def episodios(item): + logger.info() + itemlist = [] + templist = seasons(item) + for tempitem in templist: + itemlist += episodesxseasons(tempitem) + + return itemlist + +def episodesxseasons(item): + logger.info() + + itemlist = [] + + data=get_source(item.url) + patron ='class="row-serie-item">
      .*?([^' + patron += '(.*?)
      %s+x(\d+)
      ' % item.infoLabels['season'] + matches = re.compile(patron, re.DOTALL).findall(data) + + infoLabels = item.infoLabels + + for scrapedurl, scrapedthumbnail, scrapedtitle, lang_data, scrapedepisode in matches: + + infoLabels['episode'] = scrapedepisode + url = scrapedurl + language = get_language(lang_data) + title = '%sx%s - %s %s' % (infoLabels['season'], infoLabels['episode'], scrapedtitle, language) + + itemlist.append(Item(channel=item.channel, title= title, url=url, action='findvideos', + thumbnail=scrapedthumbnail, language=language, infoLabels=infoLabels)) + + itemlist = filtertools.get_links(itemlist, item, list_language) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + return itemlist + + +def findvideos(item): + logger.info() + from lib import generictools + itemlist = [] + data = get_source(item.url) + patron = '
      .*?' + patron += 'data-data="([^"]+)".*?([^<]+)<' + matches = re.compile(patron, re.DOTALL).findall(data) + + for lang_data, scrapedurl, quality in matches: + lang = get_language(lang_data) + if 'screener' in quality.lower(): + quality = 'Screener' + + quality = quality + title = '%s [%s] [%s]' + url = base64.b64decode(scrapedurl[1:]) + + itemlist.append( + Item(channel=item.channel, url=url, title=title, action='play', quality=quality, language=IDIOMAS[lang], + infoLabels=item.infoLabels)) + + itemlist = servertools.get_servers_itemlist(itemlist, lambda x: x.title % (x.server.capitalize(), x.quality, x.language)) + + # Requerido para Filtrar enlaces + + if __comprueba_enlaces__: + itemlist = servertools.check_list_links(itemlist, __comprueba_enlaces_num__) + + # Requerido para FilterTools + + itemlist = filtertools.get_links(itemlist, item, list_language, list_quality) + + # Requerido para AutoPlay + + autoplay.start(itemlist, item) + + itemlist = sorted(itemlist, key=lambda it: it.language) + + if item.contentType != 'episode': + 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() + texto = texto.replace(" ", "+") + item.url = item.url + texto + + if texto != '': + return search_results(item) + else: + return [] + +def search_results(item): + logger.info() + + itemlist=[] + + data=get_source(item.url) + patron = '
    • .*?' + patron += '(Pelicula|Serie) del año([^<]+)

      ' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, scrapedtitle, scrapedthumb, content_type, year in matches: + + title = scrapedtitle + if len(year)==0: + year = '-' + url = scrapedurl + thumbnail = scrapedthumb + if not '/serie' in url: + action = 'findvideos' + else: + action = 'seasons' + + new_item=Item(channel=item.channel, title=title, url=url, thumbnail=thumbnail, action=action, + infoLabels={'year':year}) + if new_item.action == 'findvideos': + new_item.contentTitle = new_item.title + else: + new_item.contentSerieName = new_item.title + + itemlist.append(new_item) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + return itemlist + +def newest(categoria): + logger.info() + itemlist = [] + item = Item() + try: + if categoria in ['peliculas']: + item.url = host + 'movies' + elif categoria == 'infantiles': + item.url = host + 'genero/animation/' + item.type='movies' + 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/pelispedia.py b/plugin.video.alfa/channels/pelispedia.py index 4c7b65b8..e10c382d 100644 --- a/plugin.video.alfa/channels/pelispedia.py +++ b/plugin.video.alfa/channels/pelispedia.py @@ -143,7 +143,8 @@ def listado_genero(item): itemlist = [] - data = httptools.downloadpage(item.url).data + # ~ data = httptools.downloadpage(item.url).data + data = obtener_data(item.url) data = re.sub(r"\n|\r|\t|\s{2}| |
      |
      |
      |
      |
      |-\s", "", data) if item.extra == "movies": @@ -180,7 +181,8 @@ def listado_anio(item): itemlist = [] - data = httptools.downloadpage(item.url).data + # ~ data = httptools.downloadpage(item.url).data + data = obtener_data(item.url) data = re.sub(r"\n|\r|\t|\s{2}| |
      |
      |
      |
      |
      |-\s", "", data) if item.extra == "movies": diff --git a/plugin.video.alfa/channels/pelisr.py b/plugin.video.alfa/channels/pelisr.py index c7679eb0..cdcdacb3 100644 --- a/plugin.video.alfa/channels/pelisr.py +++ b/plugin.video.alfa/channels/pelisr.py @@ -72,7 +72,7 @@ def menu_movies(item): def get_source(url): logger.info() data = httptools.downloadpage(url).data - data = re.sub(r'"|\n|\r|\t| |
      |\s{2,}', "", data) + data = re.sub(r'\n|\r|\t| |
      |\s{2,}', "", data) return data @@ -93,9 +93,9 @@ def section(item): duplicados=[] data = get_source(host+'/'+item.type) if 'Genero' in item.title: - patron = '
    • (.*?)/i>' + patron = '
    • (.*?) (.*?)<') - title = scrapertools.find_single_match(scrapedtitle,'(.*?) ([^<]+)<') + title = scrapertools.find_single_match(scrapedtitle,'([^<]+)
    • .*?([^<]+)
      (.*?).*?' - patron += '.*?<\/h3>(.*?)<\/span><\/div>' + patron = '