Merge branch 'master' into Fixes

This commit is contained in:
Unknown
2017-08-22 14:08:50 -03:00
30 changed files with 393 additions and 354 deletions
@@ -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.
+9 -10
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
+58 -75
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,13 +51,13 @@ 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")),
options.append(dict(setting.attributes.items() + [(u"category", category.getAttribute("label")),
(u"value", get_setting(setting.getAttribute("id")))]))
from platformcode import platformtools
@@ -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,29 +146,26 @@ 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 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):
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:
t = eval(value)
value = t[0](t[1])
except:
value = None
value = int(value)
except ValueError:
pass
return value
@@ -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)
+10 -9
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ó
+6 -13
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>
+110
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()
+6 -5
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>
+1 -1
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:
+2 -2
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
+1 -1
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))
@@ -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
+29 -62
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:
+1 -1
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))
+1 -1
View File
@@ -52,7 +52,7 @@
"default": 0,
"enabled": true,
"visible": true,
"llvalues": [
"lvalues": [
"No filtrar",
"Latino",
"Español",
+1 -1
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')
@@ -10,5 +10,16 @@
"categories": [
"movie",
"latino"
],
"settings": [
{
"id": "modo_grafico",
"type": "bool",
"label": "Buscar información extra",
"default": true,
"enabled": true,
"visible": true
}
]
}
+19 -2
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
__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
+44 -2
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,7 +93,9 @@ 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)
@@ -104,5 +107,44 @@ def episodios(item):
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
+4 -3
View File
@@ -138,8 +138,10 @@ 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")
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)
@@ -148,7 +150,6 @@ def get_channel_json(channel_name):
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")
+3 -1
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
+1 -1
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
+2 -2
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
+2 -2
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():
+23 -75
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.",
@@ -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,34 +199,20 @@ 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']:
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 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
except ValueError:
pass
return value
@@ -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)
+2 -2
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
-16
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
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:
+11 -5
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()
+2 -2
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)
+3 -5
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"))]