Merge pull request #2 from alfa-addon/master

update
This commit is contained in:
Alfa-beto
2017-08-22 10:05:24 -03:00
committed by GitHub
33 changed files with 597 additions and 559 deletions

View File

@@ -0,0 +1,2 @@
Debe ejecutar primero el archivo "script.py".
Una vez realizado el proceso podrá ejecutar como siempre "alfa.py" para iniciar el addon.

View File

@@ -22,7 +22,7 @@ websocket_port = config.get_setting("websocket.port")
myip = config.get_local_ip()
def ThreadNameWrap(func):
def thread_name_wrap(func):
@wraps(func)
def bar(*args, **kw):
if "name" not in kw:
@@ -32,7 +32,7 @@ def ThreadNameWrap(func):
return bar
threading.Thread.__init__ = ThreadNameWrap(threading.Thread.__init__)
threading.Thread.__init__ = thread_name_wrap(threading.Thread.__init__)
if sys.version_info < (2, 7, 11):
import ssl
@@ -40,7 +40,7 @@ if sys.version_info < (2, 7, 11):
ssl._create_default_https_context = ssl._create_unverified_context
def MostrarInfo():
def show_info():
os.system('cls' if os.name == 'nt' else 'clear')
print ("--------------------------------------------------------------------")
print ("Alfa Iniciado")
@@ -54,7 +54,6 @@ def MostrarInfo():
print ("Bookmark Path : " + config.get_setting("bookmarkpath"))
print ("Videolibrary Path : " + config.get_setting("videolibrarypath"))
print ("--------------------------------------------------------------------")
conexiones = []
controllers = platformtools.controllers
for a in controllers:
try:
@@ -68,8 +67,8 @@ def start():
logger.info("server init...")
config.verify_directories_created()
try:
HTTPServer.start(MostrarInfo)
WebSocket.start(MostrarInfo)
HTTPServer.start(show_info)
WebSocket.start(show_info)
# Da por levantado el servicio
logger.info("--------------------------------------------------------------------")
@@ -84,10 +83,10 @@ def start():
logger.info("Bookmark Path : " + config.get_setting("bookmarkpath"))
logger.info("VideoLibrary Path : " + config.get_setting("videolibrarypath"))
logger.info("--------------------------------------------------------------------")
MostrarInfo()
show_info()
start = True
while start:
flag = True
while flag:
time.sleep(1)
except KeyboardInterrupt:
@@ -96,7 +95,7 @@ def start():
print 'Deteniendo el servidor WebSocket...'
WebSocket.stop()
print 'Alfa Detenido'
start = False
flag = False
# Inicia el programa

View File

@@ -5,13 +5,12 @@
import os
import re
import threading
import sys
PLATFORM_NAME = "mediaserver"
PLUGIN_NAME = "alfa"
settings_dic = {}
settings_types = {}
adult_setting = {}
@@ -52,14 +51,14 @@ def get_system_platform():
def open_settings():
Opciones = []
options = []
from xml.dom import minidom
settings = open(menufilepath, 'rb').read()
xmldoc = minidom.parseString(settings)
for category in xmldoc.getElementsByTagName("category"):
for setting in category.getElementsByTagName("setting"):
Opciones.append(dict(setting.attributes.items() + [(u"category", category.getAttribute("label")),
(u"value", get_setting(setting.getAttribute("id")))]))
options.append(dict(setting.attributes.items() + [(u"category", category.getAttribute("label")),
(u"value", get_setting(setting.getAttribute("id")))]))
from platformcode import platformtools
global adult_setting
@@ -69,7 +68,7 @@ def open_settings():
adult_mode = get_setting('adult_mode')
adult_request_password = get_setting('adult_request_password')
platformtools.open_settings(Opciones)
platformtools.open_settings(options)
# Hemos accedido a la seccion de Canales para adultos
if get_setting('adult_aux_intro_password'):
@@ -82,22 +81,8 @@ def open_settings():
set_setting('adult_password', get_setting('adult_aux_new_password1'))
else:
platformtools.dialog_ok("Canales para adultos",
"Los campos 'Nueva contraseña' y 'Confirmar nueva contraseña' no coinciden.",
"Entre de nuevo en 'Preferencias' para cambiar la contraseña")
# Fijar adult_pin
adult_pin = ""
if get_setting("adult_request_password") == True:
adult_pin = get_setting("adult_password")
set_setting("adult_pin", adult_pin)
# Solo esta sesion:
id = threading.current_thread().name
if get_setting("adult_mode") == 2:
adult_setting[id] = True
set_setting("adult_mode", "0")
else:
adult_setting = {}
"Los campos 'Nueva contraseña' y 'Confirmar nueva contraseña' no coinciden."
, "Entre de nuevo en 'Preferencias' para cambiar la contraseña")
else:
platformtools.dialog_ok("Canales para adultos", "La contraseña no es correcta.",
@@ -112,24 +97,30 @@ def open_settings():
set_setting('adult_aux_new_password2', '')
def get_setting(name, channel="", server=""):
def get_setting(name, channel="", server="", default=None):
"""
Retorna el valor de configuracion del parametro solicitado.
Devuelve el valor del parametro 'name' en la configuracion global o en la configuracion propia del canal 'channel'.
Devuelve el valor del parametro 'name' en la configuracion global, en la configuracion propia del canal 'channel'
o en la del servidor 'server'.
Si se especifica el nombre del canal busca en la ruta \addon_data\plugin.video.alfa\settings_channels el
archivo channel_data.json y lee el valor del parametro 'name'. Si el archivo channel_data.json no existe busca en la
carpeta channels el archivo channel.xml y crea un archivo channel_data.json antes de retornar el valor solicitado.
Si el parametro 'name' no existe en channel_data.json lo busca en la configuracion global y si ahi tampoco existe
devuelve un str vacio.
Los parametros channel y server no deben usarse simultaneamente. Si se especifica el nombre del canal se devolvera
el resultado de llamar a channeltools.get_channel_setting(name, channel, default). Si se especifica el nombre del
servidor se devolvera el resultado de llamar a servertools.get_channel_setting(name, server, default). Si no se
especifica ninguno de los anteriores se devolvera el valor del parametro en la configuracion global si existe o
el valor default en caso contrario.
Parametros:
name -- nombre del parametro
channel [opcional] -- nombre del canal
@param name: nombre del parametro
@type name: str
@param channel: nombre del canal
@type channel: str
@param server: nombre del servidor
@type server: str
@param default: valor devuelto en caso de que no exista el parametro name
@type default: any
Retorna:
value -- El valor del parametro 'name'
@return: El valor del parametro 'name'
@rtype: any
"""
@@ -138,7 +129,7 @@ def get_setting(name, channel="", server=""):
# logger.info("config.get_setting reading channel setting '"+name+"' from channel json")
from core import channeltools
value = channeltools.get_channel_setting(name, channel)
value = channeltools.get_channel_setting(name, channel, default)
# logger.info("config.get_setting -> '"+repr(value)+"'")
return value
@@ -146,7 +137,7 @@ def get_setting(name, channel="", server=""):
elif server:
# logger.info("config.get_setting reading server setting '"+name+"' from server json")
from core import servertools
value = servertools.get_server_setting(name, server)
value = servertools.get_server_setting(name, server, default)
# logger.info("config.get_setting -> '"+repr(value)+"'")
return value
@@ -155,31 +146,28 @@ def get_setting(name, channel="", server=""):
else:
# logger.info("config.get_setting reading main setting '"+name+"'")
global settings_dic
value = settings_dic.get(name, "")
if name == "adult_mode":
global adult_setting
id = threading.current_thread().name
if adult_setting.get(id) == True:
value = "2"
value = settings_dic.get(name, default)
if value == default:
return value
# logger.info("config.get_setting -> '"+value+"'")
# hack para devolver el tipo correspondiente
global settings_types
if value == "true":
return True
elif value == "false":
return False
else:
# special case return as str
if name in ["adult_password", "adult_aux_intro_password", "adult_aux_new_password1",
"adult_aux_new_password2"]:
return value
else:
try:
value = int(value)
except ValueError:
pass
if settings_types.get(name) in ['enum', 'number']:
value = int(value)
elif settings_types.get(name) == 'bool':
value = value == 'true'
elif not settings_types.has_key(name):
try:
t = eval(value)
value = t[0](t[1])
except:
value = None
return value
return value
def set_setting(name, value, channel="", server=""):
@@ -214,25 +202,16 @@ def set_setting(name, value, channel="", server=""):
return servertools.set_server_setting(name, value, server)
else:
global settings_dic
global settings_types
if settings_types.get(name) == 'bool':
if isinstance(value, bool):
if value:
new_value = "true"
value = "true"
else:
new_value = "false"
elif settings_types.get(name):
new_value = str(value)
else:
if isinstance(value, basestring):
new_value = "(%s, %s)" % (type(value).__name__, repr(value))
else:
new_value = "(%s, %s)" % (type(value).__name__, value)
settings_dic[name] = new_value
value = "false"
elif isinstance(value, (int, long)):
value = str(value)
settings_dic[name] = value
from xml.dom import minidom
# Crea un Nuevo XML vacio
new_settings = minidom.getDOMImplementation().createDocument(None, "settings", None)
@@ -339,11 +318,9 @@ def get_local_ip():
def load_settings():
global settings_dic
global settings_types
defaults = {}
from xml.etree import ElementTree
encontrado = False
# Lee el archivo XML (si existe)
if os.path.exists(configfilepath):
settings = open(configfilepath, 'rb').read()
@@ -357,10 +334,9 @@ def load_settings():
for target in category.findall("setting"):
if target.get("id"):
defaults[target.get("id")] = target.get("default")
settings_types[target.get("id")] = target.get("type")
for key in defaults:
if not key in settings_dic:
if key not in settings_dic:
settings_dic[key] = defaults[key]
set_settings(settings_dic)
@@ -387,7 +363,14 @@ def set_settings(JsonRespuesta):
# Fichero de configuración
menufilepath = os.path.join(get_runtime_path(), "resources", "settings.xml")
configfilepath = os.path.join(get_data_path(), "settings.xml")
if not os.path.exists(get_data_path()): os.mkdir(get_data_path())
if not os.path.exists(get_data_path()):
os.mkdir(get_data_path())
# Literales
TRANSLATION_FILE_PATH = os.path.join(get_runtime_path(), "resources", "language", "Spanish", "strings.xml")
load_settings()
# modo adulto:
# sistema actual 0: Nunca, 1:Siempre, 2:Solo hasta que se reinicie sesión
# si es == 2 lo desactivamos.
if get_setting("adult_mode") == 2:
set_setting("adult_mode", 0)

View File

@@ -29,19 +29,20 @@ def start():
def run(item):
itemlist = []
# Muestra el item en el log:
PrintItems(item)
print_items(item)
# Control Parental, comprueba si es adulto o no
if item.action == "mainlist":
# Parental control
if channeltools.is_adult(item.channel) and config.get_setting("adult_pin") != "":
if channeltools.is_adult(item.channel) and config.get_setting("adult_request_password"):
tecleado = platformtools.dialog_input("", "Contraseña para canales de adultos", True)
if tecleado is None or tecleado != config.get_setting("adult_pin"):
if tecleado is None or tecleado != config.get_setting("adult_password"):
platformtools.render_items(None, item)
return
# Importa el canal para el item, todo item debe tener un canal, sino sale de la función
if item.channel: channelmodule = ImportarCanal(item)
if item.channel:
channelmodule = import_channel(item)
# If item has no action, stops here
if item.action == "":
@@ -153,13 +154,13 @@ def run(item):
itemlist = [Item(title="No hay elementos para mostrar", thumbnail=get_thumb("error.png"))]
# Imprime en el log el resultado
PrintItems(itemlist)
print_items(itemlist)
# Muestra los resultados en pantalla
platformtools.render_items(itemlist, item)
def ImportarCanal(item):
def import_channel(item):
channel = item.channel
channelmodule = ""
if os.path.exists(os.path.join(config.get_runtime_path(), "channels", channel + ".py")):
@@ -171,7 +172,7 @@ def ImportarCanal(item):
return channelmodule
def PrintItems(itemlist):
def print_items(itemlist):
if type(itemlist) == list:
if len(itemlist) > 0:
logger.info("Items devueltos")
@@ -197,13 +198,13 @@ def add_pelicula_to_library(item):
def add_serie_to_library(item):
channel = ImportarCanal(item)
channel = import_channel(item)
videolibrarytools.add_tvshow(item, channel)
def download_all_episodes(item, first_episode="", preferred_server="vidspot", filter_language=""):
logger.info("show=" + item.show)
channel = ImportarCanal(item)
channel = import_channel(item)
show_title = item.show
# Obtiene el listado desde el que se llamó

View File

@@ -16,15 +16,14 @@
<setting id="server_stats" type="bool" label="Enviar estadisticas sobre el uso de servidores" default="true"/>
<setting type="sep"/>
<setting label="Canales para adultos" type="lsep"/>
<setting id="adult_aux_intro_password" type="text" label="Contraseña:" option="hidden" default=""/>
<setting id="adult_aux_intro_password" type="text" label="Contraseña (por defecto 0000):" option="hidden" default=""/>
<setting id="adult_mode" type="enum" values="Nunca|Siempre|Solo para esta sesión" label="30002" enable="!eq(-1,)" default="0"/>
<setting id="adult_request_password" type="bool" label="Solicitar contraseña para abrir canal de adultos" enable="!eq(-1,0)+!eq(-2,)" default="true"/>
<setting id="adult_request_password" type="bool" label="Solicitar contraseña para abrir canales de adultos" enable="!eq(-1,0)+!eq(-2,)" default="true"/>
<setting id="adult_aux_new_password1" type="text" label="Nueva contraseña:" option="hidden" enable="!eq(-3,)" default=""/>
<setting id="adult_aux_new_password2" type="text" label="Confirmar nueva contraseña:" option="hidden" enable="!eq(-1,)" default=""/>
<!--<setting type="sep"/>-->
<!--<setting label="Actualizaciones" type="lsep"/>-->
<!--<setting id="plugin_updates_available" type="number" label="Number of updates available" default="0" visible="false"/>-->
<!--<setting id="check_for_plugin_updates" type="bool" label="30001" default="true"/>-->
<!--<setting id="check_for_channel_updates" type="bool" label="30004" default="true"/>-->
@@ -32,20 +31,14 @@
<!-- Path downloads and subtitles -->
<category label="30501">
<!--setting id="subtitulo" type="bool" label="30021" default="false"/>
<setting id="subtitle_type" type="enum" lvalues="30432|30434|30433" label ="30431" enable ="eq(-1,true)" default="0"/>
<setting id="subtitlepath_folder" type="folder" source="" enable = "eq(-1,0)+eq(-2,true)" label="30435" default=""/>
<setting id="subtitlepath_file" type="file" source="" enable = "eq(-2,2)+eq(-3,true)" label="30436" default=""/>
<setting id="subtitlepath_keyboard" type="text" enable ="eq(-3,1)+eq(-4,true)" label="30437" default=""/>
<setting type="sep"/-->
<setting type="sep"/>
<setting id="downloadpath" type="text" label="30017" default=""/>
<setting id="downloadlistpath" type="text" label="30018" default=""/>
<setting id="videolibrarypath" type="text" label="30067" default=""/>
<setting type="sep"/>
<setting label="Nombre de carpetas" type="lsep"/>
<setting id="folder_tvshows" type="text" label="Series" default="SERIES"/>
<setting id="folder_movies" type="text" label="Peliculas" default="CINE"/>
<setting label="30131" type="lsep"/>
<setting id="folder_tvshows" type="text" label="Nombre de carpeta para 'Series'" default="SERIES"/>
<setting id="folder_movies" type="text" label="Nombre de carpeta para 'Peliculas'" default="CINE"/>
</category>
</settings>
</settings>

110
mediaserver/script.py Normal file
View File

@@ -0,0 +1,110 @@
# -*- coding: utf-8 -*-
import os
import re
import shutil
from platformcode import config, logger, platformtools
def conversion():
logger.info()
data = ""
try:
# do a backup
path_settings = os.path.join(config.get_data_path(), "settings.xml")
path_settings_backup = os.path.join(config.get_data_path(), "settings.backup.xml")
shutil.copy(path_settings, path_settings_backup)
# open file
f = open(path_settings, "r")
# copy = open(path_settings2, "w")
logger.info(" ---")
logger.info(" --- 1")
logger.info(" --- 2")
logger.info(" --- 3")
data_aux = ""
begin_tag = "<settings>\n"
end_tag = "</settings>\n"
adult_data = ' <setting id="adult_aux_intro_password" value="" />\n'
adult_data += ' <setting id="adult_aux_new_password1" value="" />\n'
adult_data += ' <setting id="adult_aux_new_password2" value="" />\n'
adult_data += ' <setting id="adult_mode" value="0" />\n'
adult_data += ' <setting id="adult_password" value="0000" />\n'
adult_data += ' <setting id="adult_request_password" value="false" />\n'
for line in f:
matches = re.findall('<setting id="([^"]*)" value="([^"]*)', line, re.DOTALL)
logger.info("macthes %s" % matches)
if not matches:
logger.info("no matches")
# for <settings></settings> tag
# data += line
else:
logger.info("Matches")
for _id, value in matches:
logger.info(" dentro del for")
logger.info(" _id:%s value:%s" % (_id, value))
if _id not in ["adult_aux_intro_password", "adult_aux_new_password1", "adult_aux_new_password2",
"adult_mode", "adult_password", "adult_request_password", "adult_pin"]:
logger.info(" linea %s" % line)
logger.info(" value %s" % value)
if value:
# logger.info(" type value!! %s" % type(value))
logger.info(" antes value!! %s" % value)
if "(str, " in value:
if "(str, &apos;" in value:
value = value.replace("(str, &apos;", "")
value = value.replace("&apos;)", "")
elif "(str, '":
value = value.replace("(str, '", "")
value = value.replace("')", "")
elif "(bool, " in value:
value = value.replace("(bool, ", "")
if value == "True)":
value = "true"
else:
value = "false"
value = value.replace('\\\\', '\\')
logger.info(" despues value!! %s" % value)
aux_line = '<setting id="%s" value="%s" />\n' % (_id, value)
logger.info(" aux_line %s" % aux_line)
data_aux += " " + aux_line
f.close()
data = begin_tag + adult_data + data_aux + end_tag
copy_file = open(path_settings, "w")
copy_file.write(data)
copy_file.close()
while True:
import sys
logger.info("sys ve %s" % sys.version_info)
if sys.version_info > (3, 0):
value = input("Alfa\nCorregido un error en la seccion adultos, se ha reseteado la contrasena a por "
"defecto, tendra que cambiarla de nuevo si lo desea.\n Escriba 's', si lo ha entendido: ")
else:
value = raw_input("Alfa\nCorregido un error en la seccion adultos, se ha reseteado la contrasena a por "
"defecto, tendra que cambiarla de nuevo si lo desea.\n Escriba 's', si lo ha entendido: ")
logger.debug("value %s" % value)
if value.lower() == 's':
break
logger.info("En disclaimer clickó 'No'")
logger.info("En disclaimer clickó 'Si'")
except Exception, ex:
template = "An exception of type %s occured. Arguments:\n%r"
message = template % (type(ex).__name__, ex.args)
logger.info(message)
print("Alfa", "Error, en conversión")
logger.info("Datos a guardar %s" % data)
if __name__ == "__main__":
conversion()

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.alfa" name="Alfa" version="1.5.4" provider-name="Alfa Addon">
<addon id="plugin.video.alfa" name="Alfa" version="1.7.0" provider-name="Alfa Addon">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.libtorrent" optional="true"/>
@@ -19,10 +19,11 @@
</assets>
<news>[B]Estos son los cambios para esta versión:[/B]
[COLOR green][B]Arreglos[/B][/COLOR]
[I]- streamix.cloud
- tvseriesdk
- newpct
- fix internos[/I]
[I]- arreglo sección adultos
[I]- flashx
- fixes internos[/I]
[COLOR green]Gracias a [COLOR yellow][B]msdos[/B][/COLOR] por su colaboración en esta versión[/COLOR]
</news>
<description lang="es">Navega con Kodi por páginas web para ver sus videos de manera fácil.</description>
<summary lang="en">Browse web pages using Kodi</summary>

2
plugin.video.alfa/channels/animeflv.py Executable file → Normal file
View File

@@ -223,7 +223,7 @@ def episodios(item):
item.plot = scrapertools.find_single_match(data, 'Description[^>]+><p>(.*?)</p>')
matches = re.compile('href="([^"]+)"><figure><img class="[^"]+" data-original="([^"]+)".+?</h3>'
'<p>(.*?)</p>', re.DOTALL).findall(data)
'\s*<p>(.*?)</p>', re.DOTALL).findall(data)
if matches:
for url, thumb, title in matches:

View File

@@ -381,10 +381,10 @@ def check_value(channel, itemlist):
quality_list = channel_node['quality'] = list()
for item in itemlist:
if item.server not in server_list:
if item.server not in server_list and item.server !='':
server_list.append(item.server)
change = True
if item.quality not in quality_list:
if item.quality not in quality_list and item.quality !='':
quality_list.append(item.quality)
change = True

View File

@@ -40,7 +40,7 @@ def lista(item):
server="datoporn", fanart=scrapedthumbnail.replace("_t.jpg", ".jpg")))
# Extrae la marca de siguiente página
next_page = scrapertools.find_single_match(data, "<a href='([^']+)'>Next")
next_page = scrapertools.find_single_match(data, '<a href="([^"]+)">Next')
if next_page and itemlist:
itemlist.append(item.clone(action="lista", title=">> Página Siguiente", url=next_page))

View File

@@ -61,30 +61,3 @@ def search(item, texto):
return todas(item)
else:
return []
def findvideos(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
patron = '<li.*?<a href="([^"]+)" target="_blank"><i class="icon-metro online"><\/i><span>Ver.*?<\/span><\/a> <\/li>'
matches = re.compile(patron, re.DOTALL).findall(data)
for scrapedurl in matches:
title = item.title
url = scrapedurl
itemlist.append(item.clone(title=title, url=url, action="play"))
return itemlist
def play(item):
logger.info()
itemlist = []
item.url = item.url.replace(' ', '%20')
data = httptools.downloadpage(item.url, add_referer=True).data
url = scrapertools.find_single_match(data, '<iframe.*?src="([^"]+)".*?frameborder="0"')
itemlist = servertools.find_video_items(data=data)
return itemlist

View File

@@ -17,7 +17,6 @@ def mainlist(item):
itemlist = list()
itemlist.append(Item(channel=item.channel, action="series", title="Novedades",
url=urlparse.urljoin(CHANNEL_HOST, "archivos/h2/"), extra="novedades"))
itemlist.append(Item(channel=item.channel, action="letras", title="Por orden alfabético"))
itemlist.append(Item(channel=item.channel, action="generos", title="Por géneros", url=CHANNEL_HOST))
itemlist.append(Item(channel=item.channel, action="series", title="Sin Censura",
url=urlparse.urljoin(CHANNEL_HOST, "archivos/sin-censura/")))
@@ -25,20 +24,6 @@ def mainlist(item):
url=urlparse.urljoin(CHANNEL_HOST, "archivos/hight-definition/")))
itemlist.append(Item(channel=item.channel, action="series", title="Mejores Hentais",
url=urlparse.urljoin(CHANNEL_HOST, "archivos/ranking-hentai/")))
itemlist.append(Item(channel=item.channel, action="search", title="Buscar",
url=urlparse.urljoin(CHANNEL_HOST, "?s=")))
return itemlist
def letras(item):
logger.info()
itemlist = []
for letra in '0ABCDEFGHIJKLMNOPQRSTUVWXYZ':
itemlist.append(Item(channel=item.channel, action="series", title=letra,
url=urlparse.urljoin(CHANNEL_HOST, "/?s=letra-%s" % letra.replace("0", "num"))))
return itemlist
@@ -47,49 +32,34 @@ def generos(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|\s{2}", "", data)
data = re.sub(r"\n|\r|\t|\s{2}", "", httptools.downloadpage(item.url).data)
data = scrapertools.get_match(data, "<div class='cccon'>(.*?)</div><div id=\"myslides\">")
patron = "<a.+? href='/([^']+)'>(.*?)</a>"
pattern = 'id="hentai2"><div[^>]+>(.*?)</div></div>'
data = scrapertools.find_single_match(data, pattern)
patron = 'href="([^"]+)"[^>]+>(.*?)</a>'
matches = re.compile(patron, re.DOTALL).findall(data)
for scrapedurl, scrapedtitle in matches:
title = scrapertools.entityunescape(scrapedtitle)
url = urlparse.urljoin(item.url, scrapedurl)
for url, title in matches:
# logger.debug("title=[{0}], url=[{1}]".format(title, url))
itemlist.append(Item(channel=item.channel, action="series", title=title, url=url))
return itemlist
def search(item, texto):
logger.info()
if item.url == "":
item.url = urlparse.urljoin(CHANNEL_HOST, "animes/?buscar=")
texto = texto.replace(" ", "+")
item.url = "%s%s" % (item.url, texto)
try:
return series(item)
# Se captura la excepción, para no interrumpir al buscador global si un canal falla
except:
import sys
for line in sys.exc_info():
logger.error("%s" % line)
return []
def series(item):
logger.info()
data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|\s{2}", "", httptools.downloadpage(item.url).data)
patron = '<div class="post" id="post"[^<]+<center><h1 class="post-title entry-title"[^<]+<a href="([^"]+)">' \
'(.*?)</a>[^<]+</h1></center>[^<]+<div[^<]+</div>[^<]+<div[^<]+<div.+?<img src="([^"]+)"'
pattern = "<div class='wp-pagenavi'>(.*?)</div>"
pagination = scrapertools.find_single_match(data, pattern)
matches = re.compile(patron, re.DOTALL).findall(data)
pattern = '<div class="col-xs-12 col-md-12 col-lg-9px-3"><ul>(.*?)</ul><div class="clearfix">'
data = scrapertools.find_single_match(data, pattern)
pattern = '<a href="([^"]+)".*?<img src="([^"]+)" title="([^"]+)"'
matches = re.compile(pattern, re.DOTALL).findall(data)
itemlist = []
if item.extra == "novedades":
@@ -97,25 +67,20 @@ def series(item):
else:
action = "episodios"
for scrapedurl, scrapedtitle, scrapedthumbnail in matches:
title = scrapertools.unescape(scrapedtitle)
for url, thumbnail, title in matches:
fulltitle = title
url = urlparse.urljoin(item.url, scrapedurl)
thumbnail = urlparse.urljoin(item.url, scrapedthumbnail)
show = title
# logger.debug("title=[{0}], url=[{1}], thumbnail=[{2}]".format(title, url, thumbnail))
itemlist.append(Item(channel=item.channel, action=action, title=title, url=url, thumbnail=thumbnail,
show=show, fulltitle=fulltitle, fanart=thumbnail, folder=True))
patron = '</span><a class="page larger" href="([^"]+)"'
matches = re.compile(patron, re.DOTALL).findall(data)
for match in matches:
if len(matches) > 0:
scrapedurl = match
scrapedtitle = ">> Pagina Siguiente"
if pagination:
page = scrapertools.find_single_match(pagination, '>Página\s*(\d+)\s*de\s*\d+<')
pattern = 'href="([^"]+)">%s<' % (int(page) + 1)
url_page = scrapertools.find_single_match(pagination, pattern)
itemlist.append(Item(channel=item.channel, action="series", title=scrapedtitle, url=scrapedurl,
folder=True, viewmode="movies_with_plot"))
if url_page:
itemlist.append(Item(channel=item.channel, action="series", title=">> Página Siguiente", url=url_page))
return itemlist
@@ -124,9 +89,11 @@ def episodios(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
data = scrapertools.find_single_match(data, '<div class="listanime">(.*?)</div>')
patron = '<a href="([^"]+)">([^<]+)</a>'
data = re.sub(r"\n|\r|\t|\s{2}", "", httptools.downloadpage(item.url).data)
pattern = '<div class="box-entry-title text-center">Lista de Capítulos</div>(.*?)</div></div>'
data = scrapertools.find_single_match(data, pattern)
patron = '<a href="([^"]+)"[^>]+>([^<]+)</a>'
matches = re.compile(patron, re.DOTALL).findall(data)
for scrapedurl, scrapedtitle in matches:
@@ -136,10 +103,9 @@ def episodios(item):
plot = item.plot
# logger.debug("title=[{0}], url=[{1}], thumbnail=[{2}]".format(title, url, thumbnail))
itemlist.append(Item(channel=item.channel, action="findvideos", title=title, url=url,
thumbnail=thumbnail, plot=plot, show=item.show, fulltitle="%s %s" % (item.show, title),
fanart=thumbnail, viewmode="movies_with_plot", folder=True))
fanart=thumbnail))
return itemlist
@@ -148,7 +114,8 @@ def findvideos(item):
logger.info()
data = httptools.downloadpage(item.url).data
patron = '<div id="tab\d".+?>[^<]+<[iframe|IFRAME].*?[src|SRC]="([^"]+)"'
patron = '<(?:iframe)?(?:IFRAME)?\s*(?:src)?(?:SRC)?="([^"]+)"'
matches = re.compile(patron, re.DOTALL).findall(data)
for url in matches:

View File

@@ -101,7 +101,7 @@ def generos(item):
matches = scrapertools.find_multiple_matches(data, '<li class="cat-item cat-item-.*?><a href="([^"]+)".*?>(.*?)<b>')
for scrapedurl, scrapedtitle in matches:
if scrapedtitle == "Eroticas +18 " and config.get_setting("adult_mode") != "0":
if scrapedtitle == "Eroticas +18 " and config.get_setting("adult_mode") != 0:
itemlist.append(item.clone(action="eroticas", title=scrapedtitle, url=scrapedurl))
elif (scrapedtitle != "Estrenos ") and (scrapedtitle != "Próximos Estrenos "):
itemlist.append(item.clone(action="entradas", title=scrapedtitle, url=scrapedurl))

View File

@@ -52,7 +52,7 @@
"default": 0,
"enabled": true,
"visible": true,
"llvalues": [
"lvalues": [
"No filtrar",
"Latino",
"Español",
@@ -76,4 +76,4 @@
"visible": true
}
]
}
}

View File

@@ -345,13 +345,13 @@ def temporadas(item):
itemlist = []
templist = []
data = httptools.downloadpage(item.url).data
data = data.replace ('"',"'")
realplot = ''
patron = "<button class='classnamer' onclick='javascript: mostrarcapitulos.*?blank'>([^<]+)</button>"
patron = "<button class='classnamer' onclick='javascript: mostrarcapitulos.*?blank'>([^<]+)<\/button>"
matches = re.compile(patron, re.DOTALL).findall(data)
serieid = scrapertools.find_single_match(data, 'data-nonce="(.*?)"')
serieid = scrapertools.find_single_match(data, "data-nonce='(.*?)'")
item.thumbnail = item.thumbvid
infoLabels = item.infoLabels
for scrapedtitle in matches:
@@ -408,6 +408,7 @@ def episodiosxtemp(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
data = data.replace('"', "'")
patron = "<button class='classnamer' onclick='javascript: mostrarenlaces\(([^\)]+)\).*?<"
matches = re.compile(patron, re.DOTALL).findall(data)
@@ -640,7 +641,7 @@ def play(item):
logger.info()
data = httptools.downloadpage(item.url).data
if 'streamplay' not in item.server or 'streame' not in item.server:
if item.server not in ['streamplay','streame']:
url = scrapertools.find_single_match(data, '<(?:IFRAME|iframe).*?(?:SRC|src)=*([^ ]+) (?!style|STYLE)')
else:
url = scrapertools.find_single_match(data, '<meta http-equiv="refresh" content="0; url=([^"]+)">')

View File

@@ -222,7 +222,7 @@ def show_result(item):
if item.adult and config.get_setting("adult_request_password"):
# Solicitar contraseña
tecleado = platformtools.dialog_input("", "Contraseña para canales de adultos", True)
if tecleado is None or tecleado != config.get_setting("adult_pin"):
if tecleado is None or tecleado != config.get_setting("adult_password"):
return []
item.channel = item.__dict__.pop('from_channel')

View File

@@ -1,182 +1,185 @@
# -*- coding: utf-8 -*-
# -*- Channel TVSeriesdk -*-
# -*- Created for Alfa-addon -*-
# -*- By the Alfa Develop Group -*-
import re
from core import httptools
from core import scrapertools
from core import servertools
from core.item import Item
from platformcode import config, logger
host = 'http://www.tvseriesdk.com/'
def mainlist(item):
logger.info()
itemlist = list()
itemlist.append(item.clone(title="Ultimos", action="last_episodes", url=host))
itemlist.append(item.clone(title="Todas", action="list_all", url=host))
itemlist.append(item.clone(title="Buscar", action="search", url='http://www.tvseriesdk.com/index.php?s='))
return itemlist
def get_source(url):
logger.info()
data = httptools.downloadpage(url).data
data = re.sub(r'"|\n|\r|\t|&nbsp;|<br>|\s{2,}', "", data)
return data
def list_all(item):
logger.info()
global i
templist = []
data = get_source(item.url)
patron = '<li class=cat-item cat-item-\d+><a href=(.*?) title=(.*?)>(.*?)<\/a>'
matches = re.compile(patron, re.DOTALL).findall(data)
if len(matches) > 10:
if item.next_page != 10:
url_next_page = item.url
matches = matches[:10]
next_page = 10
item.i = 0
else:
patron = matches[item.i:][:10]
next_page = 10
url_next_page = item.url
for scrapedurl, scrapedplot, scrapedtitle in matches:
url = scrapedurl
plot = scrapedplot
contentSerieName = scrapedtitle
title = contentSerieName
templist.append(item.clone(action='episodios',
title=title,
url=url,
thumbnail='',
plot=plot,
contentErieName=contentSerieName
))
itemlist = get_thumb(templist)
# Paginación
if url_next_page:
itemlist.append(item.clone(title="Siguiente >>", url=url_next_page, next_page=next_page, i=item.i))
return itemlist
def last_episodes(item):
logger.info()
itemlist = []
data = get_source(item.url)
patron = '<div class=pelis>.*?<a href=(.*?) title=(.*?)><img src=(.*?) alt='
matches = re.compile(patron, re.DOTALL).findall(data)
for scrapedurl, scrapedtitle, scrapedthumbnail in matches:
url = scrapedurl
title = scrapedtitle
thumbnail = scrapedthumbnail
itemlist.append(item.clone(action='findvideos',
title=title,
url=url,
thumbnail=thumbnail
))
return itemlist
def episodios(item):
logger.info()
itemlist = []
data = get_source(item.url)
patron = '<a href=(.*?) class=lcc>(.*?)<\/a>'
matches = re.compile(patron, re.DOTALL).findall(data)
n_ep = 1
for scrapedurl, scrapedtitle in matches[::-1]:
url = scrapedurl
scrapedtitle = re.sub(r'Capítulo \d+', '', scrapedtitle)
title = '1x%s - %s' % (n_ep, scrapedtitle)
itemlist.append(
item.clone(action='findvideos', title=title, url=url, contentEpisodeNumber=n_ep, contentSeasonNumber='1'))
n_ep += 1
return itemlist
def get_thumb(itemlist):
logger.info()
for item in itemlist:
data = get_source(item.url)
item.thumbnail = scrapertools.find_single_match(data, '<div class=sinope><img src=(.*?) alt=')
return itemlist
def search_list(item):
logger.info()
itemlist = []
data = get_source(item.url)
patron = 'img title.*?src=(.*?) width=.*?class=tisearch><a href=(.*?)>(.*?)<\/a>'
matches = re.compile(patron, re.DOTALL).findall(data)
for scrapedthumb, scrapedurl, scrapedtitle in matches:
title = scrapedtitle
url = scrapedurl
thumbnail = scrapedthumb
itemlist.append(item.clone(title=title, url=url, thumbnail=thumbnail, action='findvideos'))
# Pagination < link
next_page = scrapertools.find_single_match(data, '<link rel=next href=(.*?) />')
if next_page:
itemlist.append(Item(channel=item.channel, action="search_list", title='>> Pagina Siguiente', url=next_page,
thumbnail=config.get_thumb("thumb_next.png")))
return itemlist
def search(item, texto):
logger.info()
texto = texto.replace(" ", "+")
item.url = item.url + texto
if texto != '':
return search_list(item)
else:
return []
def findvideos(item):
logger.info()
itemlist = []
servers = {'netu': 'http://hqq.tv/player/embed_player.php?vid=',
'open': 'https://openload.co/embed/',
'netv': 'http://goo.gl/',
'gamo': 'http://gamovideo.com/embed-',
'powvideo': 'http://powvideo.net/embed-',
'play': 'http://streamplay.to/embed-',
'vido': 'http://vidoza.net/embed-'}
data = get_source(item.url)
patron = 'id=tab\d+.*?class=tab_content><script>(.*?)\((.*?)\)<\/script>'
matches = re.compile(patron, re.DOTALL).findall(data)
for server, video_id in matches:
if server not in ['gamo', 'powvideo', 'play', 'vido', 'netv']:
url = servers[server] + video_id
elif server == 'netv':
url = get_source(servers[server] + video_id)
else:
url = servers[server] + video_id + '.html'
itemlist.extend(servertools.find_video_items(data=url))
for videoitem in itemlist:
videoitem.channel = item.channel
videoitem.title = item.title + ' (%s)' % videoitem.server
videoitem.action = 'play'
return itemlist
# -*- coding: utf-8 -*-
# -*- Channel TVSeriesdk -*-
# -*- Created for Alfa-addon -*-
# -*- By the Alfa Develop Group -*-
import re
from core import httptools
from core import scrapertools
from core import servertools
from core.item import Item
from platformcode import config, logger
host = 'http://www.tvseriesdk.com/'
def mainlist(item):
logger.info()
itemlist = list()
itemlist.append(item.clone(title="Ultimos", action="last_episodes", url=host))
itemlist.append(item.clone(title="Todas", action="list_all", url=host))
itemlist.append(item.clone(title="Buscar", action="search", url='http://www.tvseriesdk.com/index.php?s='))
return itemlist
def get_source(url):
logger.info()
data = httptools.downloadpage(url).data
data = re.sub(r'"|\n|\r|\t|&nbsp;|<br>|\s{2,}', "", data)
return data
def list_all(item):
logger.info()
global i
templist = []
data = get_source(item.url)
patron = '<li class=cat-item cat-item-\d+><a href=(.*?) title=(.*?)>(.*?)<\/a>'
matches = re.compile(patron, re.DOTALL).findall(data)
if len(matches) > 10:
if item.next_page != 10:
url_next_page = item.url
matches = matches[:10]
next_page = 10
item.i = 0
else:
patron = matches[item.i:][:10]
next_page = 10
url_next_page = item.url
for scrapedurl, scrapedplot, scrapedtitle in matches:
url = scrapedurl
plot = scrapedplot
contentSerieName = scrapedtitle
title = contentSerieName
templist.append(item.clone(action='episodios',
title=title,
url=url,
thumbnail='',
plot=plot,
contentErieName=contentSerieName
))
itemlist = get_thumb(templist)
# Paginación
if url_next_page:
itemlist.append(item.clone(title="Siguiente >>", url=url_next_page, next_page=next_page, i=item.i))
return itemlist
def last_episodes(item):
logger.info()
itemlist = []
data = get_source(item.url)
patron = '<div class=pelis>.*?<a href=(.*?) title=(.*?)><img src=(.*?) alt='
matches = re.compile(patron, re.DOTALL).findall(data)
for scrapedurl, scrapedtitle, scrapedthumbnail in matches:
url = scrapedurl
title = scrapedtitle
thumbnail = scrapedthumbnail
itemlist.append(item.clone(action='findvideos',
title=title,
url=url,
thumbnail=thumbnail
))
return itemlist
def episodios(item):
logger.info()
itemlist = []
data = get_source(item.url)
patron = '<a href=(.*?) class=lcc>(.*?)<\/a>'
matches = re.compile(patron, re.DOTALL).findall(data)
n_ep = 1
for scrapedurl, scrapedtitle in matches[::-1]:
url = scrapedurl
scrapedtitle = re.sub(r'Capítulo \d+', '', scrapedtitle)
title = '1x%s - %s' % (n_ep, scrapedtitle)
itemlist.append(
item.clone(action='findvideos', title=title, url=url, contentEpisodeNumber=n_ep, contentSeasonNumber='1'))
n_ep += 1
return itemlist
def get_thumb(itemlist):
logger.info()
for item in itemlist:
data = get_source(item.url)
item.thumbnail = scrapertools.find_single_match(data, '<div class=sinope><img src=(.*?) alt=')
return itemlist
def search_list(item):
logger.info()
itemlist = []
data = get_source(item.url)
patron = 'img title.*?src=(.*?) width=.*?class=tisearch><a href=(.*?)>(.*?)<\/a>'
matches = re.compile(patron, re.DOTALL).findall(data)
for scrapedthumb, scrapedurl, scrapedtitle in matches:
title = scrapedtitle
url = scrapedurl
thumbnail = scrapedthumb
itemlist.append(item.clone(title=title, url=url, thumbnail=thumbnail, action='findvideos'))
# Pagination < link
next_page = scrapertools.find_single_match(data, '<link rel=next href=(.*?) />')
if next_page:
itemlist.append(Item(channel=item.channel, action="search_list", title='>> Pagina Siguiente', url=next_page,
thumbnail=config.get_thumb("thumb_next.png")))
return itemlist
def search(item, texto):
logger.info()
texto = texto.replace(" ", "+")
item.url = item.url + texto
if texto != '':
return search_list(item)
else:
return []
def findvideos(item):
logger.info()
itemlist = []
servers = {'netu': 'http://hqq.tv/player/embed_player.php?vid=',
'open': 'https://openload.co/embed/',
'netv': 'http://goo.gl/',
'gamo': 'http://gamovideo.com/embed-',
'powvideo': 'http://powvideo.net/embed-',
'play': 'http://streamplay.to/embed-',
'vido': 'http://vidoza.net/embed-'}
data = get_source(item.url)
noemitido = scrapertools.find_single_match(data, '<p><img src=(http://darkiller.com/images/subiendo.png) border=0\/><\/p>')
patron = 'id=tab\d+.*?class=tab_content><script>(.*?)\((.*?)\)<\/script>'
matches = re.compile(patron, re.DOTALL).findall(data)
if not noemitido:
for server, video_id in matches:
if server not in ['gamo', 'powvideo', 'play', 'vido', 'netv']:
url = servers[server] + video_id
elif server == 'netv':
url = get_source(servers[server] + video_id)
else:
url = servers[server] + video_id + '.html'
itemlist.extend(servertools.find_video_items(data=url))
for videoitem in itemlist:
videoitem.channel = item.channel
videoitem.title = item.title + ' (%s)' % videoitem.server
videoitem.action = 'play'
else:
itemlist.append(item.clone(title = 'Este capitulo aun no esta disponible', action='', url=''))
return itemlist

View File

@@ -9,7 +9,17 @@
"version": 1,
"categories": [
"movie",
"latino",
"direct"
"latino"
],
"settings": [
{
"id": "modo_grafico",
"type": "bool",
"label": "Buscar información extra",
"default": true,
"enabled": true,
"visible": true
}
]
}
}

View File

@@ -14,9 +14,16 @@ from core import scrapertools
from core import servertools
from core.item import Item
from platformcode import config, logger
from core import tmdb
host = "http://ver-peliculas.io/"
__channel__ = "ver-peliculas"
host = "http://ver-peliculas.org/"
try:
__modo_grafico__ = config.get_setting('modo_grafico', __channel__)
except:
__modo_grafico__ = True
def mainlist(item):
logger.info()
@@ -115,19 +122,22 @@ def listado(item):
logger.info()
itemlist = []
data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data)
logger.debug(data)
# logger.debug(data)
pattern = '<a href="([^"]+)"[^>]+><img (?:src)?(?:data-original)?="([^"]+)".*?alt="([^"]+)"'
matches = re.compile(pattern, re.DOTALL).findall(data)
for url, thumb, title in matches:
title = title.replace("Película", "", 1)
year = scrapertools.find_single_match(url, '-(\d+)-online')
title = title.replace("Película", "", 1).partition(" /")[0].partition(":")[0]
itemlist.append(Item(channel=item.channel,
action="findvideos",
title=title,
infoLabels={"year": year},
url=url,
thumbnail=thumb,
contentTitle=title
))
tmdb.set_infoLabels(itemlist, __modo_grafico__)
pagination = scrapertools.find_single_match(data, '<ul class="pagination">(.*?)</ul>')
if pagination:
@@ -140,6 +150,13 @@ def listado(item):
url=url,
thumbnail=get_thumb("next.png")))
for item in itemlist:
if item.infoLabels['plot'] == '':
data = httptools.downloadpage(item.url).data
item.plot = scrapertools.find_single_match(data, '<div class="desc">([^<]+)</div>').strip()
item.fanart = scrapertools.find_single_match(data, '<meta property="og:image" content="([^"]+)"/>')
return itemlist
@@ -156,18 +173,18 @@ def findvideos(item):
data = get_source(item.url)
video_info = scrapertools.find_single_match(data, "load_player\('(.*?)','(.*?)'\);")
movie_info = scrapertools.find_single_match(item.url, 'http:\/\/ver-peliculas\.io\/peliculas\/(\d+)-(.*?)-\d{'
movie_info = scrapertools.find_single_match(item.url, 'http:\/\/ver-peliculas\.org\/peliculas\/(\d+)-(.*?)-\d{'
'4}-online\.')
movie_id = movie_info[0]
movie_name = movie_info[1]
sub = video_info[1]
url_base = 'http://ver-peliculas.io/core/api.php?id=%s&slug=%s' % (movie_id, movie_name)
url_base = 'http://ver-peliculas.org/core/api.php?id=%s&slug=%s' % (movie_id, movie_name)
data = httptools.downloadpage(url_base).data
json_data = jsontools.load(data)
video_list = json_data['lista']
itemlist = []
for videoitem in video_list:
video_base_url = 'http://ver-peliculas.io/core/videofinal.php'
video_base_url = 'http://ver-peliculas.org/core/videofinal.php'
if video_list[videoitem] != None:
video_lang = video_list[videoitem]
languages = ['latino', 'spanish', 'subtitulos']
@@ -184,12 +201,12 @@ def findvideos(item):
for video_link in sources:
url = video_link['sources']
if 'onevideo' in url:
data = get_source(url)
g_urls = servertools.findvideos(data=data)
url = g_urls[0][1]
server = g_urls[0][0]
if url not in duplicated:
# if 'onevideo' in url:
# data = get_source(url)
# g_urls = servertools.findvideos(data=data)
# url = g_urls[0][1]
# server = g_urls[0][0]
if url not in duplicated and server!='drive':
lang = lang.capitalize()
if lang == 'Spanish':
lang = 'Español'

View File

@@ -6,8 +6,9 @@ from core import httptools
from core import scrapertools
from core.item import Item
from platformcode import logger
from core import servertools
host = 'http://www.18hentaionline.eu/'
host = 'http://www.18hentaionline.net/'
headers = [['User-Agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0'],
['Referer', host]]
@@ -92,17 +93,58 @@ def episodios(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url, headers=headers).data
patron = '<td>([^<]+)<\/td>.<td>([^<]+)<\/td>.<td>([^<]+)<\/td>.<td>([^<]+)<\/td>.<td><a href="([^"]+)".*?>Ver Capitulo<\/a><\/td>'
old_mode = scrapertools.find_single_match(data, '<th>Censura<\/th>')
if old_mode:
patron = '<td>(\d+)<\/td><td>(.*?)<\/td><td>(.*?)<\/td><td>(.*?)<\/td><td><a href="(.*?)".*?>Ver Capitulo<\/a><\/td>'
matches = re.compile(patron, re.DOTALL).findall(data)
matches = re.compile(patron, re.DOTALL).findall(data)
for scrapedcap, scrapedaud, scrapedsub, scrapedcen, scrapedurl in matches:
url = scrapedurl
title = 'CAPITULO ' + scrapedcap + ' AUDIO: ' + scrapedaud + ' SUB:' + scrapedsub + ' ' + censura[scrapedcen]
thumbnail = ''
plot = ''
fanart = ''
itemlist.append(Item(channel=item.channel, action="findvideos", title=title, fulltitle=item.fulltitle, url=url,
thumbnail=item.thumbnail, plot=plot))
for scrapedcap, scrapedaud, scrapedsub, scrapedcen, scrapedurl in matches:
url = scrapedurl
title = 'CAPITULO ' + scrapedcap + ' AUDIO: ' + scrapedaud + ' SUB:' + scrapedsub + ' ' + censura[scrapedcen]
thumbnail = ''
plot = ''
fanart = ''
itemlist.append(Item(channel=item.channel, action="findvideos", title=title, fulltitle=item.fulltitle, url=url,
thumbnail=item.thumbnail, plot=plot))
else:
patron = '<\/i>.*?(.\d+)<\/td><td style="text-align:center">MP4<\/td><td style="text-align:center">(.*?)<\/td>.*?'
patron +='<a class="dr-button" href="(.*?)" >'
matches = re.compile(patron, re.DOTALL).findall(data)
for scrapedcap, scrapedsub, scrapedurl in matches:
url = scrapedurl
if scrapedsub !='':
subs= scrapedsub
else:
sub = 'No'
title = 'CAPITULO %s SUB %s'%(scrapedcap, subs)
thumbnail = ''
plot = ''
fanart = ''
itemlist.append(Item(channel=item.channel, action="findvideos", title=title, fulltitle=item.fulltitle, url=url,
thumbnail=item.thumbnail, plot=plot))
return itemlist
def findvideos(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
gvideo = scrapertools.find_single_match(data,'<li rel="(http:\/\/www\.18hentaionline\.net\/ramus\/phar\.php\?vid=.*?)">')
headers = {'Host':'www.18hentaionline.net', 'Referer':item.url}
gvideo_data = httptools.downloadpage(gvideo, headers = headers).data
gvideo_url = scrapertools.find_single_match(gvideo_data, 'file: "(.*?)"')
server = 'directo'
new_item = (item.clone(url=gvideo_url, server=server))
itemlist.append(new_item)
itemlist.extend(servertools.find_video_items(data=data))
for videoitem in itemlist:
videoitem.channel = item.channel
videoitem.title = item.title+' (%s)'%videoitem.server
videoitem.action = 'play'
return itemlist

View File

@@ -138,17 +138,18 @@ def get_channel_parameters(channel_name):
def get_channel_json(channel_name):
# logger.info("channel_name=" + channel_name)
import filetools
channel_json = None
try:
channel_path = filetools.join(config.get_runtime_path(), "channels", channel_name + ".json")
# logger.info("channel_data=" + channel_path)
channel_json = jsontools.load(filetools.read(channel_path))
# logger.info("channel_json= %s" % channel_json)
if filetools.isfile(channel_path):
# logger.info("channel_data=" + channel_path)
channel_json = jsontools.load(filetools.read(channel_path))
# logger.info("channel_json= %s" % channel_json)
except Exception, ex:
template = "An exception of type %s occured. Arguments:\n%r"
message = template % (type(ex).__name__, ex.args)
logger.error(" %s" % message)
channel_json = None
return channel_json
@@ -187,10 +188,10 @@ def get_channel_setting(name, channel, default=None):
@param channel: nombre del canal
@type channel: str
@param default: valor devuelto en caso de que no exista el parametro name
@type default: cualquiera
@type default: any
@return: El valor del parametro 'name'
@rtype: El tipo del valor del parametro
@rtype: any
"""
file_settings = os.path.join(config.get_data_path(), "settings_channels", channel + "_data.json")

View File

@@ -446,7 +446,9 @@ def mkdir(path):
except:
logger.error("ERROR al crear el directorio: %s" % path)
logger.error(traceback.format_exc())
platformtools.dialog_notification("Error al crear el directorio", path)
# platformtools.dialog_notification("Error al crear el directorio", path)
platformtools.dialog_ok("Alfa", "[COLOR red][B]IMPORTANTE[/B][/COLOR] - Instale y Ejecute el script 'Fix version 1.7.0', que se encuentra en el repositorio de Alfa y "
"vuelva a entrar en el addon, [B]si no lo hace tendrá problemas[/B]")
return False
else:
return True

View File

@@ -188,7 +188,7 @@ def cuadro_completar(item):
'visible': True})
# logger.debug(dict_default)
if platformtools.show_channel_settings(listado_controles, caption="Completar información", item=item,
if platformtools.show_channel_settings(list_controls=listado_controles, caption="Completar información", item=item,
callback="core.scraper.callback_cuadro_completar",
custom_button={"visible": False}):
return True

View File

@@ -565,10 +565,10 @@ def get_server_setting(name, server, default=None):
@param server: nombre del servidor
@type server: str
@param default: valor devuelto en caso de que no exista el parametro name
@type default: cualquiera
@type default: any
@return: El valor del parametro 'name'
@rtype: El tipo del valor del parametro
@rtype: any
"""
# Creamos la carpeta si no existe

View File

@@ -14,11 +14,11 @@ def get_current_plugin_version():
def get_current_plugin_version_tag():
return "4.3.0-beta1"
return "1.7.0"
def get_current_plugin_date():
return "30/06/2017"
return "22/08/2017"
def get_current_channels_version():

View File

@@ -8,7 +8,6 @@ import re
import xbmc
import xbmcaddon
import xbmcgui
PLUGIN_NAME = "alfa"
@@ -112,17 +111,11 @@ def open_settings():
# Cambio de contraseña
if settings_post['adult_aux_new_password1']:
if settings_post['adult_aux_new_password1'] == settings_post['adult_aux_new_password2']:
adult_password = set_setting('adult_password', settings_post['adult_aux_new_password1'])
set_setting('adult_password', settings_post['adult_aux_new_password1'])
else:
platformtools.dialog_ok("Canales para adultos",
"Los campos 'Nueva contraseña' y 'Confirmar nueva contraseña' no coinciden.",
"Entre de nuevo en 'Preferencias' para cambiar la contraseña")
# Fijar adult_pin
adult_pin = ""
if settings_post["adult_request_password"] == True:
adult_pin = adult_password
set_setting("adult_pin", adult_pin)
"Los campos 'Nueva contraseña' y 'Confirmar nueva contraseña' no coinciden."
, "Entre de nuevo en 'Preferencias' para cambiar la contraseña")
else:
platformtools.dialog_ok("Canales para adultos", "La contraseña no es correcta.",
@@ -140,8 +133,8 @@ def open_settings():
# si se ha cambiado la ruta de la videoteca llamamos a comprobar directorios para que lo cree y pregunte
# automaticamente si configurar la videoteca
if settings_pre.get("videolibrarypath", None) != settings_post.get("videolibrarypath", None) or \
settings_pre.get("folder_movies", None) != settings_post.get("folder_movies", None) or \
settings_pre.get("folder_tvshows", None) != settings_post.get("folder_tvshows", None):
settings_pre.get("folder_movies", None) != settings_post.get("folder_movies", None) or \
settings_pre.get("folder_tvshows", None) != settings_post.get("folder_tvshows", None):
verify_directories_created()
else:
@@ -156,13 +149,13 @@ def get_setting(name, channel="", server="", default=None):
"""
Retorna el valor de configuracion del parametro solicitado.
Devuelve el valor del parametro 'name' en la configuracion global, en la configuracion propia del canal 'channel'
Devuelve el valor del parametro 'name' en la configuracion global, en la configuracion propia del canal 'channel'
o en la del servidor 'server'.
Los parametros channel y server no deben usarse simultaneamente. Si se especifica el nombre del canal se devolvera
el resultado de llamar a channeltools.get_channel_setting(name, channel, default). Si se especifica el nombre del
Los parametros channel y server no deben usarse simultaneamente. Si se especifica el nombre del canal se devolvera
el resultado de llamar a channeltools.get_channel_setting(name, channel, default). Si se especifica el nombre del
servidor se devolvera el resultado de llamar a servertools.get_channel_setting(name, server, default). Si no se
especifica ninguno de los anteriores se devolvera el valor del parametro en la configuracion global si existe o
especifica ninguno de los anteriores se devolvera el valor del parametro en la configuracion global si existe o
el valor default en caso contrario.
@param name: nombre del parametro
@@ -172,10 +165,10 @@ def get_setting(name, channel="", server="", default=None):
@param server: nombre del servidor
@type server: str
@param default: valor devuelto en caso de que no exista el parametro name
@type default: cualquiera
@type default: any
@return: El valor del parametro 'name'
@rtype: El tipo del valor del parametro
@rtype: any
"""
@@ -206,35 +199,21 @@ def get_setting(name, channel="", server="", default=None):
value = xbmc.translatePath(value)
# hack para devolver el tipo correspondiente
settings_types = get_settings_types()
if settings_types.get(name) in ['enum', 'number']:
try:
value = int(value)
except Exception, ex:
from platformcode import logger
logger.error("Error al convertir '%s' de tipo 'enum','number' \n%s" % (name, ex))
elif settings_types.get(name) == 'bool':
value = value == 'true'
elif name not in settings_types:
try:
if value in ['true', 'false']:
if value == 'true':
aux_val = True
else:
aux_val = False
value = bool(aux_val)
else:
t = eval(value)
value = t[0](t[1])
except Exception, ex:
from platformcode import logger
logger.error("Error al convertir '%s' se pasa como tipo 'None'\n%s" % (name, ex))
value = None
return value
if value == "true":
return True
elif value == "false":
return False
else:
# special case return as str
if name in ["adult_password", "adult_aux_intro_password", "adult_aux_new_password1",
"adult_aux_new_password2"]:
return value
else:
try:
value = int(value)
except ValueError:
pass
return value
def set_setting(name, value, channel="", server=""):
@@ -269,25 +248,16 @@ def set_setting(name, value, channel="", server=""):
return servertools.set_server_setting(name, value, server)
else:
try:
settings_types = get_settings_types()
if settings_types.get(name) == 'bool':
if isinstance(value, bool):
if value:
new_value = "true"
value = "true"
else:
new_value = "false"
value = "false"
elif settings_types.get(name):
new_value = str(value)
elif isinstance(value, (int, long)):
value = str(value)
else:
if isinstance(value, basestring):
new_value = "(%s, %s)" % (type(value).__name__, repr(value))
else:
new_value = "(%s, %s)" % (type(value).__name__, value)
__settings__.setSetting(name, new_value)
__settings__.setSetting(name, value)
except Exception, ex:
from platformcode import logger
@@ -297,28 +267,6 @@ def set_setting(name, value, channel="", server=""):
return value
def get_settings_types():
"""
Devuelve un diccionario con los parametros (key) de la configuracion global y sus tipos (value)
:return: dict
"""
win10000 = xbmcgui.Window(10000)
settings_types = win10000.getProperty(PLUGIN_NAME + "_settings_types")
if not settings_types:
infile = open(os.path.join(get_runtime_path(), "resources", "settings.xml"))
data = infile.read()
infile.close()
matches = re.findall('<setting id="([^"]*)" type="([^"]*)', data)
settings_types = "{%s}" % ",".join("'%s': '%s'" % tup for tup in matches)
win10000.setProperty(PLUGIN_NAME + "_settings_types", settings_types)
return eval(settings_types)
def get_localized_string(code):
dev = __language__(code)
@@ -448,7 +396,7 @@ def verify_directories_created():
for f in files:
if not filetools.exists(filetools.join(default, folder, f)) or \
(filetools.getsize(filetools.join(default, folder, f)) !=
filetools.getsize(filetools.join(default, '720p', f))):
filetools.getsize(filetools.join(default, '720p', f))):
filetools.copy(filetools.join(default, '720p', f),
filetools.join(default, folder, f),
True)

View File

@@ -129,9 +129,9 @@ def run(item=None):
# Parental control
# If it is an adult channel, and user has configured pin, asks for it
if channeltools.is_adult(item.channel) and config.get_setting("adult_pin") != "":
if channeltools.is_adult(item.channel) and config.get_setting("adult_request_password"):
tecleado = platformtools.dialog_input("", "Contraseña para canales de adultos", True)
if tecleado is None or tecleado != config.get_setting("adult_pin"):
if tecleado is None or tecleado != config.get_setting("adult_password"):
return
# # Actualiza el canal individual

View File

@@ -20,7 +20,6 @@
<setting id="adult_aux_new_password1" type="text" label="Nueva contraseña:" option="hidden" enable="!eq(-3,)" default=""/>
<setting id="adult_aux_new_password2" type="text" label="Confirmar nueva contraseña:" option="hidden" enable="!eq(-1,)" default=""/>
<!--<setting type="sep"/>-->
<!--<setting label="Actualizaciones" type="lsep"/>-->
<!--<setting id="plugin_updates_available" type="number" label="Number of updates available" default="0" visible="false"/>-->
@@ -30,13 +29,6 @@
<!-- Path downloads and subtitles -->
<category label="30501">
<!--setting id="subtitulo" type="bool" label="30021" default="false"/>
<setting id="subtitle_type" type="enum" lvalues="30432|30434|30433" label ="30431" enable ="eq(-1,true)" default="0"/>
<setting id="subtitlepath_folder" type="folder" source="" enable = "eq(-1,0)+eq(-2,true)" label="30435" default=""/>
<setting id="subtitlepath_file" type="file" source="" enable = "eq(-2,2)+eq(-3,true)" label="30436" default=""/>
<setting id="subtitlepath_keyboard" type="text" enable ="eq(-3,1)+eq(-4,true)" label="30437" default=""/>
<setting type="sep"/-->
<setting id="path_selection" type="enum" values="Escribir ruta|Examinar ruta" default="0" label="Tipo de ruta"/>
<setting id="downloadpath" type="text" label="30017" default="" visible="eq(-1,0)"/>
<setting id="downloadpath" type="folder" label="30017" default="" visible="eq(-2,1)"/>
@@ -54,14 +46,6 @@
</category>
<category label="Otros"><!--30503 -->
<!--
<setting label="Filtros" type="lsep"/>
<setting id="filter_servers" type="bool" label="30068" default="false"/>
<setting label="30071" type="lsep"/>
<setting id="whitelist" type="text" label="30069" enable="eq(-2,true)" default=""/>
<setting id="blacklist" type="text" label="30070" enable="eq(-3,true)" default=""/>
-->
<setting label="Info de películas/series en menú contextual" type="lsep"/>
<setting id="infoplus" type="bool" label="Mostrar opción Infoplus:" default="true"/>
<setting id="extended_info" type="bool" label="Mostrar opción ExtendedInfo (Necesario addon externo):" default="false"/>

1
plugin.video.alfa/servers/flashx.py Executable file → Normal file
View File

@@ -40,6 +40,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
pass
matches = scrapertools.find_multiple_matches(data, "<script type='text/javascript'>(.*?)</script>")
m = ""
for n, m in enumerate(matches):
if m.startswith("eval"):
try:

16
plugin.video.alfa/servers/mp4upload.py Executable file → Normal file
View File

@@ -1,17 +1,23 @@
# -*- coding: utf-8 -*-
import re
from core import httptools
from core import scrapertools
from lib import jsunpack
from platformcode import logger
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
logger.info("(page_url='%s')" % page_url)
data = scrapertools.cache_page(page_url)
logger.info("data=" + data)
media_url = scrapertools.find_single_match(data, '"file": "(.+?)"')
logger.info("media_url=" + media_url)
media_url = media_url.replace("?start=0", "")
data = re.sub(r"\n|\r|\t|\s{2}", "", httptools.downloadpage(page_url).data)
match = scrapertools.find_single_match(data, "<script type='text/javascript'>(.*?)</script>")
data = jsunpack.unpack(match)
data = data.replace("\\'", "'")
media_url = scrapertools.find_single_match(data, '{type:"video/mp4",src:"([^"]+)"}')
logger.info("media_url=" + media_url)
video_urls = list()

4
plugin.video.alfa/servers/openload.py Executable file → Normal file
View File

@@ -52,7 +52,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
numeros = scrapertools.find_multiple_matches(data,
'_[A-f0-9]+x[A-f0-9]+\s*(?:=|\^)\s*([0-9]{4,}|0x[A-f0-9]{4,})')
op1, op2 = scrapertools.find_single_match(data, '\(0x(\d),0x(\d)\);')
idparse = scrapertools.find_single_match(data, "\^parseInt\('([0-9]+)'")
videourl = ""
for encode in var_encodes:
text_decode = ""
@@ -81,7 +81,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
if value3 < index1:
break
value4 = value2 ^ decode1[j % (mult / 8)]
value4 = value2 ^ decode1[j % (mult / 8)] ^ int(idparse,8)
for n in numeros:
if not n.isdigit():
n = int(n, 16)

View File

@@ -26,12 +26,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
referer = re.sub(r"embed-|player-", "", page_url)[:-5]
data = httptools.downloadpage(page_url, headers={'Referer': referer}).data
for list in scrapertools.find_multiple_matches(data, '_[^=]+=(\[[^\]]+\]);'):
if len(list) == 703 or len(list) == 711:
key = "".join(eval(list)[7:9])
break
if key.startswith("embed"):
key = key[6:] + key[:6]
matches = scrapertools.find_single_match(data, "<script type=[\"']text/javascript[\"']>(eval.*?)</script>")
data = jsunpack.unpack(matches).replace("\\", "")
@@ -40,7 +35,8 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
video_urls = []
for video_url in matches:
_hash = scrapertools.find_single_match(video_url, '[A-z0-9\_\-]{40,}')
hash = decrypt(_hash, key)
hash = _hash[::-1]
hash = hash.replace(hash[2:3],"",1)
video_url = video_url.replace(_hash, hash)
filename = scrapertools.get_filename_from_url(video_url)[-4:]

View File

@@ -235,12 +235,10 @@ if __name__ == "__main__":
import xbmc
# modo adulto:
# Conversion de False y True al sitema actual 0: Nunca, 1:Siempre, 2:Solo hasta que se reinicie Kodi
# y si es == 2 lo desactivamos.
if config.get_setting("adult_mode") == False or config.get_setting("adult_mode") == 2:
# sistema actual 0: Nunca, 1:Siempre, 2:Solo hasta que se reinicie Kodi
# si es == 2 lo desactivamos.
if config.get_setting("adult_mode") == 2:
config.set_setting("adult_mode", 0)
elif config.get_setting("adult_mode") == True:
config.set_setting("adult_mode", 1)
update_wait = [0, 10000, 20000, 30000, 60000]
wait = update_wait[int(config.get_setting("update_wait", "videolibrary"))]