Merge remote-tracking branch 'alfa-addon/master'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="plugin.video.alfa" name="Alfa" version="2.4.4" provider-name="Alfa Addon">
|
||||
<addon id="plugin.video.alfa" name="Alfa" version="2.4.5" provider-name="Alfa Addon">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="2.1.0"/>
|
||||
<import addon="script.module.libtorrent" optional="true"/>
|
||||
@@ -19,8 +19,11 @@
|
||||
</assets>
|
||||
<news>[B]Estos son los cambios para esta versión:[/B]
|
||||
[COLOR green][B]Canales agregados y arreglos[/B][/COLOR]
|
||||
» pelisplus » pelisplusco
|
||||
» gvideo ¤ arreglos internos
|
||||
» cinetux » peliculasgratis
|
||||
» gamovideo » peliculasaudiolatino
|
||||
» streamixcloud » uptobox
|
||||
» canalpelis » verpelis
|
||||
¤ arreglos internos
|
||||
</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>
|
||||
|
||||
@@ -357,19 +357,24 @@ def findvideos(item):
|
||||
data = httptools.downloadpage(item.url).data
|
||||
|
||||
data = re.sub(r"\n|\r|\t|\(.*?\)|\s{2}| ", "", data)
|
||||
patron = '<div id="option-(\d+)" class="play-box-iframe.*?src="([^"]+)" frameborder="0" scrolling="no" allowfullscreen></iframe>'
|
||||
|
||||
patron = '<div id="option-(\d+)" class="play-box-iframe.*?src="([^"]+)" frameborder="0" scrolling="no" ' \
|
||||
'allowfullscreen></iframe>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for option, url in matches:
|
||||
lang = scrapertools.find_single_match(
|
||||
data, '<li><a class="options" href="#option-%s"><b class="icon-play_arrow"><\/b> (.*?)<span class="dt_flag">' % option)
|
||||
lang = scrapertools.find_single_match(data,
|
||||
'<li><a class="options" href="#option-%s"><b class="icon-play_arrow"><\/b> (.*?)<span '
|
||||
'class="dt_flag">' % option)
|
||||
lang = lang.replace('Español ', '').replace('B.S.O. ', '')
|
||||
|
||||
data_b = httptools.downloadpage(urlparse.urljoin(host, url), headers={'Referer': item.url}).data
|
||||
patron = '<iframe[^>]+src="([^"]+)"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data_b)
|
||||
url = matches[0]
|
||||
server = servertools.get_server_from_url(url)
|
||||
title = "%s [COLOR yellow](%s) (%s)[/COLOR]" % (item.contentTitle, server.title(), lang)
|
||||
itemlist.append(item.clone(action='play', url=url, title=title, extra1=title,
|
||||
server=server, language = lang, text_color=color3))
|
||||
itemlist.append(item.clone(action='play', url=url, title=title, extra1=title, server=server, language=lang,
|
||||
text_color=color3))
|
||||
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
title='[COLOR yellow]Añadir esta pelicula a la videoteca[/COLOR]',
|
||||
|
||||
@@ -182,18 +182,15 @@ def destacadas(item):
|
||||
matches = scrapertools.find_multiple_matches(bloque, patron)
|
||||
for scrapedtitle, scrapedurl, scrapedthumbnail in matches:
|
||||
scrapedurl = CHANNEL_HOST + scrapedurl
|
||||
scrapedtitle = scrapedtitle.replace("Ver ", "")
|
||||
new_item = item.clone(action="findvideos", title=scrapedtitle, fulltitle=scrapedtitle,
|
||||
itemlist.append(item.clone(action="findvideos", title=scrapedtitle, fulltitle=scrapedtitle,
|
||||
url=scrapedurl, thumbnail=scrapedthumbnail,
|
||||
contentType="movie")
|
||||
itemlist.append(new_item)
|
||||
|
||||
contentType="movie"
|
||||
))
|
||||
# Extrae el paginador
|
||||
next_page_link = scrapertools.find_single_match(data, '<a href="([^"]+)"\s+><span [^>]+>»</span>')
|
||||
if next_page_link:
|
||||
itemlist.append(
|
||||
item.clone(action="destacadas", title=">> Página siguiente", url=next_page_link, text_color=color3))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -243,13 +240,9 @@ def findvideos(item):
|
||||
|
||||
# Busca el argumento
|
||||
data = httptools.downloadpage(item.url).data
|
||||
year = scrapertools.find_single_match(item.title, "\(([0-9]+)")
|
||||
|
||||
tmdb.set_infoLabels(item, __modo_grafico__)
|
||||
|
||||
if not item.infoLabels.get('plot'):
|
||||
plot = scrapertools.find_single_match(data, '<div class="sinopsis"><p>(.*?)</p>')
|
||||
item.infoLabels['plot'] = plot
|
||||
if item.infoLabels["year"]:
|
||||
tmdb.set_infoLabels(item, __modo_grafico__)
|
||||
|
||||
if filtro_enlaces != 0:
|
||||
list_enlaces = bloque_enlaces(data, filtro_idioma, dict_idiomas, "online", item)
|
||||
|
||||
@@ -15,6 +15,8 @@ from core import scrapertools
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from platformcode import platformtools
|
||||
from core import jsontools
|
||||
from channels import side_menu
|
||||
|
||||
THUMBNAILS = {'0': 'posters', '1': 'banners', '2': 'squares'}
|
||||
|
||||
@@ -27,11 +29,16 @@ perfil = [['0xFF0B7B92', '0xFF89FDFB', '0xFFACD5D4'],
|
||||
['0xFFA5DEE5', '0xFFE0F9B5', '0xFFFEFDCA'],
|
||||
['0xFFF23557', '0xFF22B2DA', '0xFFF0D43A']]
|
||||
|
||||
#color1, color2, color3 = ["white", "white", "white"]
|
||||
color1, color2, color3 = perfil[__perfil__]
|
||||
|
||||
list_newest = []
|
||||
list_newest_tourl = []
|
||||
channels_id_name = {}
|
||||
|
||||
menu_cache_path = os.path.join(config.get_data_path(), "settings_channels", 'menu_cache_data.json')
|
||||
menu_settings_path = os.path.join(config.get_data_path(), "settings_channels", 'menu_settings_data.json')
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
@@ -150,6 +157,54 @@ def get_channels_list():
|
||||
|
||||
return list_canales, any_active
|
||||
|
||||
def set_cache(item):
|
||||
logger.info()
|
||||
item.mode = 'set_cache'
|
||||
t = Thread(target=novedades, args=[item])
|
||||
t.start()
|
||||
#t.join()
|
||||
|
||||
def get_from_cache(item):
|
||||
logger.info()
|
||||
itemlist=[]
|
||||
cache_node = jsontools.get_node_from_file('menu_cache_data.json', 'cached')
|
||||
first=item.last
|
||||
last = first+40
|
||||
#if last >=len(cache_node[item.extra]):
|
||||
# last = len(cache_node[item.extra])
|
||||
|
||||
for cached_item in cache_node[item.extra][first:last]:
|
||||
new_item= Item()
|
||||
new_item = new_item.fromurl(cached_item)
|
||||
itemlist.append(new_item)
|
||||
if item.mode == 'silent':
|
||||
set_cache(item)
|
||||
if last >= len(cache_node[item.extra]):
|
||||
item.mode='finish'
|
||||
itemlist = add_menu_items(item, itemlist)
|
||||
else:
|
||||
item.mode='get_cached'
|
||||
item.last =last
|
||||
itemlist = add_menu_items(item, itemlist)
|
||||
|
||||
return itemlist
|
||||
|
||||
def add_menu_items(item, itemlist):
|
||||
logger.info()
|
||||
|
||||
menu_icon = get_thumb('menu.png')
|
||||
menu = Item(channel="channelselector", action="getmainlist", viewmode="movie", thumbnail=menu_icon, title='Menu')
|
||||
itemlist.insert(0, menu)
|
||||
if item.mode != 'finish':
|
||||
if item.mode == 'get_cached':
|
||||
last=item.last
|
||||
else:
|
||||
last = len(itemlist)
|
||||
refresh_icon = get_thumb('more.png')
|
||||
refresh = item.clone(thumbnail=refresh_icon, mode='get_cached',title='Mas', last=last)
|
||||
itemlist.insert(len(itemlist), refresh)
|
||||
|
||||
return itemlist
|
||||
|
||||
def novedades(item):
|
||||
logger.info()
|
||||
@@ -159,6 +214,14 @@ def novedades(item):
|
||||
list_newest = []
|
||||
start_time = time.time()
|
||||
|
||||
mode = item.mode
|
||||
if mode == '':
|
||||
mode = 'normal'
|
||||
|
||||
if mode=='get_cached':
|
||||
if os.path.exists(menu_cache_path):
|
||||
return get_from_cache(item)
|
||||
|
||||
multithread = config.get_setting("multithread", "news")
|
||||
logger.info("multithread= " + str(multithread))
|
||||
|
||||
@@ -170,8 +233,22 @@ def novedades(item):
|
||||
if config.set_setting("multithread", True, "news"):
|
||||
multithread = True
|
||||
|
||||
progreso = platformtools.dialog_progress(item.category, "Buscando canales...")
|
||||
if mode == 'normal':
|
||||
progreso = platformtools.dialog_progress(item.category, "Buscando canales...")
|
||||
|
||||
list_canales, any_active = get_channels_list()
|
||||
|
||||
if mode=='silent' and any_active and len(list_canales[item.extra]) > 0:
|
||||
side_menu.set_menu_settings(item)
|
||||
aux_list=[]
|
||||
for canal in list_canales[item.extra]:
|
||||
if len(aux_list)<2:
|
||||
aux_list.append(canal)
|
||||
list_canales[item.extra]=aux_list
|
||||
|
||||
if mode == 'set_cache':
|
||||
list_canales[item.extra] = list_canales[item.extra][2:]
|
||||
|
||||
if any_active and len(list_canales[item.extra])>0:
|
||||
import math
|
||||
# fix float porque la division se hace mal en python 2.x
|
||||
@@ -191,12 +268,14 @@ def novedades(item):
|
||||
t = Thread(target=get_newest, args=[channel_id, item.extra], name=channel_title)
|
||||
t.start()
|
||||
threads.append(t)
|
||||
progreso.update(percentage, "", "Buscando en '%s'..." % channel_title)
|
||||
if mode == 'normal':
|
||||
progreso.update(percentage, "", "Buscando en '%s'..." % channel_title)
|
||||
|
||||
# Modo single Thread
|
||||
else:
|
||||
logger.info("Obteniendo novedades de channel_id=" + channel_id)
|
||||
progreso.update(percentage, "", "Buscando en '%s'..." % channel_title)
|
||||
if mode == 'normal':
|
||||
logger.info("Obteniendo novedades de channel_id=" + channel_id)
|
||||
progreso.update(percentage, "", "Buscando en '%s'..." % channel_title)
|
||||
get_newest(channel_id, item.extra)
|
||||
|
||||
# Modo Multi Thread: esperar q todos los hilos terminen
|
||||
@@ -208,25 +287,29 @@ def novedades(item):
|
||||
percentage = int(math.ceil(index * t))
|
||||
|
||||
list_pendent_names = [a.getName() for a in pendent]
|
||||
mensaje = "Buscando en %s" % (", ".join(list_pendent_names))
|
||||
progreso.update(percentage, "Finalizado en %d/%d canales..." % (len(threads) - len(pendent), len(threads)),
|
||||
if mode == 'normal':
|
||||
mensaje = "Buscando en %s" % (", ".join(list_pendent_names))
|
||||
progreso.update(percentage, "Finalizado en %d/%d canales..." % (len(threads) - len(pendent), len(threads)),
|
||||
mensaje)
|
||||
logger.debug(mensaje)
|
||||
logger.debug(mensaje)
|
||||
|
||||
if progreso.iscanceled():
|
||||
logger.info("Busqueda de novedades cancelada")
|
||||
break
|
||||
if progreso.iscanceled():
|
||||
logger.info("Busqueda de novedades cancelada")
|
||||
break
|
||||
|
||||
time.sleep(0.5)
|
||||
pendent = [a for a in threads if a.isAlive()]
|
||||
|
||||
mensaje = "Resultados obtenidos: %s | Tiempo: %2.f segundos" % (len(list_newest), time.time() - start_time)
|
||||
progreso.update(100, mensaje, " ", " ")
|
||||
logger.info(mensaje)
|
||||
start_time = time.time()
|
||||
# logger.debug(start_time)
|
||||
if mode == 'normal':
|
||||
mensaje = "Resultados obtenidos: %s | Tiempo: %2.f segundos" % (len(list_newest), time.time() - start_time)
|
||||
progreso.update(100, mensaje, " ", " ")
|
||||
logger.info(mensaje)
|
||||
start_time = time.time()
|
||||
# logger.debug(start_time)
|
||||
|
||||
result_mode = config.get_setting("result_mode", "news")
|
||||
if mode != 'normal':
|
||||
result_mode=0
|
||||
|
||||
if result_mode == 0: # Agrupados por contenido
|
||||
ret = group_by_content(list_newest)
|
||||
elif result_mode == 1: # Agrupados por canales
|
||||
@@ -237,13 +320,19 @@ def novedades(item):
|
||||
while time.time() - start_time < 2:
|
||||
# mostrar cuadro de progreso con el tiempo empleado durante almenos 2 segundos
|
||||
time.sleep(0.5)
|
||||
|
||||
progreso.close()
|
||||
return ret
|
||||
if mode == 'normal':
|
||||
progreso.close()
|
||||
if mode == 'silent':
|
||||
set_cache(item)
|
||||
item.mode = 'set_cache'
|
||||
ret = add_menu_items(item, ret)
|
||||
if mode != 'set_cache':
|
||||
return ret
|
||||
else:
|
||||
no_channels = platformtools.dialog_ok('Novedades - %s'%item.extra, 'No se ha definido ningun canal para la '
|
||||
'busqueda.','Utilice el menu contextual '
|
||||
'para agregar al menos uno')
|
||||
if mode != 'set_cache':
|
||||
no_channels = platformtools.dialog_ok('Novedades - %s'%item.extra, 'No se ha definido ningun canal para la '
|
||||
'busqueda.','Utilice el menu contextual '
|
||||
'para agregar al menos uno')
|
||||
return
|
||||
|
||||
|
||||
@@ -251,6 +340,7 @@ def get_newest(channel_id, categoria):
|
||||
logger.info("channel_id=" + channel_id + ", categoria=" + categoria)
|
||||
|
||||
global list_newest
|
||||
global list_newest_tourl
|
||||
|
||||
# Solicitamos las novedades de la categoria (item.extra) buscada en el canal channel
|
||||
# Si no existen novedades para esa categoria en el canal devuelve una lista vacia
|
||||
@@ -271,11 +361,22 @@ def get_newest(channel_id, categoria):
|
||||
logger.info("running channel " + modulo.__name__ + " " + modulo.__file__)
|
||||
list_result = modulo.newest(categoria)
|
||||
logger.info("canal= %s %d resultados" % (channel_id, len(list_result)))
|
||||
|
||||
exist=False
|
||||
if os.path.exists(menu_cache_path):
|
||||
cache_node = jsontools.get_node_from_file('menu_cache_data.json', 'cached')
|
||||
exist=True
|
||||
else:
|
||||
cache_node = {}
|
||||
#logger.debug('cache node: %s' % cache_node)
|
||||
for item in list_result:
|
||||
# logger.info("item="+item.tostring())
|
||||
item.channel = channel_id
|
||||
list_newest.append(item)
|
||||
list_newest_tourl.append(item.tourl())
|
||||
|
||||
cache_node[categoria] = list_newest_tourl
|
||||
|
||||
jsontools.update_node(cache_node, 'menu_cache_data.json', "cached")
|
||||
|
||||
except:
|
||||
logger.error("No se pueden recuperar novedades de: " + channel_id)
|
||||
|
||||
@@ -43,7 +43,7 @@ def newest(categoria):
|
||||
elif categoria == 'terror':
|
||||
item.url = HOST + '/genero/terror.html'
|
||||
itemlist = peliculas(item)
|
||||
if "Pagina" in itemlist[-1].title:
|
||||
if ">> Página siguiente" in itemlist[-1].title:
|
||||
itemlist.pop()
|
||||
except:
|
||||
import sys
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"id": "quierodibujosanimados",
|
||||
"name": "Quiero Dibujos Animados",
|
||||
"active": true,
|
||||
"adult": false,
|
||||
"language": ["cast"],
|
||||
"thumbnail": "quierodibujosanimados.png",
|
||||
"banner": "quierodibujosanimados.png",
|
||||
"fanart": "quierodibujosanimados.jpg",
|
||||
"categories": [
|
||||
"tvshow"
|
||||
]
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
import urlparse
|
||||
|
||||
from core import scrapertools
|
||||
from core.item import Item
|
||||
from platformcode import logger
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
|
||||
# itemlist.append( Item(channel=item.channel , action="novedades" , title="Novedades" , url="http://www.quierodibujosanimados.com/"))
|
||||
return series(
|
||||
Item(channel=item.channel, action="series", title="Series", url="http://www.quierodibujosanimados.com/",
|
||||
fanart=item.fanart))
|
||||
|
||||
|
||||
def series(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
data = scrapertools.cache_page(item.url)
|
||||
data = scrapertools.get_match(data, '<ul class="categorias">(.*?)</ul')
|
||||
|
||||
# <a href="http://www.quierodibujosanimados.com/cat/popeye-el-marino/38" title="Popeye el marino">Popeye el marino</a>
|
||||
patron = '<a href="([^"]+)"[^>]+>([^<]+)</a>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
title = scrapedtitle.strip()
|
||||
url = urlparse.urljoin(item.url, scrapedurl)
|
||||
thumbnail = ""
|
||||
plot = ""
|
||||
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="episodios", title=title, url=url, thumbnail=thumbnail, plot=plot,
|
||||
fanart=item.fanart))
|
||||
|
||||
next_page_url = scrapertools.find_single_match(data, '</span[^<]+<a href="([^"]+)">')
|
||||
if next_page_url != "":
|
||||
itemlist.append(Item(channel=item.channel, action="episodios", title=">> Página siguiente",
|
||||
url=urlparse.urljoin(item.url, next_page_url), folder=True,
|
||||
fanart=item.fanart))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def episodios(item):
|
||||
logger.info()
|
||||
|
||||
'''
|
||||
<li>
|
||||
<div class="info">
|
||||
<h2><a href="http://www.quierodibujosanimados.com/Caillou-raton-de-biblioteca/954" title="Caillou ratón de biblioteca">Caillou ratón de biblioteca</a></h2>
|
||||
<p>Caillou volvía con su hermanita Rosi y su mamá de la biblioteca y traían un montón de libros que Caillou quería leer, especialmente uno de piratas. Capítulo titulado "Caillou ratón de biblioteca".</p>
|
||||
<div class="pie">
|
||||
<div class="categoria">
|
||||
<span>Categoría:</span>
|
||||
<a href="http://www.quierodibujosanimados.com/cat/caillou/14" title="Caillou" class="categoria">Caillou</a>
|
||||
</div>
|
||||
<div class="puntuacion">
|
||||
<div class="rating_16 punt_0" data-noticia="954">
|
||||
<span>0.5</span>
|
||||
<span>1</span>
|
||||
<span>1.5</span>
|
||||
<span>2</span>
|
||||
<span>2.5</span>
|
||||
<span>3</span>
|
||||
<span>3.5</span>
|
||||
<span>4</span>
|
||||
<span>4.5</span>
|
||||
<span>5</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="pico"></span>
|
||||
</div>
|
||||
<div class="dibujo">
|
||||
<a href="http://www.quierodibujosanimados.com/Caillou-raton-de-biblioteca/954" title="Caillou ratón de biblioteca" class="thumb">
|
||||
<img src="http://www.quierodibujosanimados.com/i/thm-Caillou-raton-de-biblioteca.jpg" alt="Caillou ratón de biblioteca" width="137" height="174" />
|
||||
</a>
|
||||
<h4><a href="http://www.quierodibujosanimados.com/Caillou-raton-de-biblioteca/954" title="Caillou ratón de biblioteca">Caillou ratón de biblioteca</a></h4>
|
||||
</div>
|
||||
</li>
|
||||
'''
|
||||
|
||||
# Descarga la pagina
|
||||
data = scrapertools.cache_page(item.url)
|
||||
patron = '<div class="dibujo"[^<]+'
|
||||
patron += '<a href="([^"]+)" title="([^"]+)"[^<]+'
|
||||
patron += '<img src="([^"]+)"'
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
itemlist = []
|
||||
|
||||
for scrapedurl, scrapedtitle, scrapedthumbnail in matches:
|
||||
title = scrapedtitle.strip()
|
||||
url = urlparse.urljoin(item.url, scrapedurl)
|
||||
thumbnail = urlparse.urljoin(item.url, scrapedthumbnail)
|
||||
plot = ""
|
||||
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=thumbnail, plot=plot,
|
||||
fanart=item.fanart))
|
||||
|
||||
next_page_url = scrapertools.find_single_match(data, '</span[^<]+<a href="([^"]+)">')
|
||||
if next_page_url != "":
|
||||
itemlist.append(Item(channel=item.channel, action="episodios", title=">> Página siguiente",
|
||||
url=urlparse.urljoin(item.url, next_page_url), folder=True,
|
||||
fanart=item.fanart))
|
||||
|
||||
return itemlist
|
||||
341
plugin.video.alfa/channels/side_menu.py
Normal file
341
plugin.video.alfa/channels/side_menu.py
Normal file
@@ -0,0 +1,341 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# ------------------------------------------------------------
|
||||
|
||||
import os
|
||||
from core.item import Item
|
||||
from core import jsontools
|
||||
from platformcode import config, logger
|
||||
from platformcode import launcher
|
||||
import xbmc, xbmcgui, xbmcplugin, xbmcaddon
|
||||
|
||||
media_path = os.path.join(config.get_runtime_path(), "resources/skins/Default/media/side_menu/")
|
||||
menu_settings_path = os.path.join(config.get_data_path(), "settings_channels", 'menu_settings_data.json')
|
||||
|
||||
if os.path.exists(menu_settings_path):
|
||||
menu_node = jsontools.get_node_from_file('menu_setting_data.json', 'menu')
|
||||
else:
|
||||
menu_node = {'categoria actual':config.get_setting('category')}
|
||||
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
|
||||
|
||||
|
||||
|
||||
ACTION_SHOW_FULLSCREEN = 36
|
||||
ACTION_GESTURE_SWIPE_LEFT = 511
|
||||
ACTION_SELECT_ITEM = 7
|
||||
ACTION_PREVIOUS_MENU = 10
|
||||
ACTION_MOVE_LEFT = 1
|
||||
ACTION_MOVE_RIGHT = 2
|
||||
ACTION_MOVE_DOWN = 4
|
||||
ACTION_MOVE_UP = 3
|
||||
|
||||
def set_menu_settings(item):
|
||||
if os.path.exists(menu_settings_path):
|
||||
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
|
||||
else:
|
||||
menu_node = {}
|
||||
menu_node['categoria actual'] = item.extra
|
||||
|
||||
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
|
||||
|
||||
def check_user_home(item):
|
||||
logger.info()
|
||||
if os.path.exists(menu_settings_path):
|
||||
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
|
||||
if 'user_home' in menu_node:
|
||||
item = Item().fromurl(menu_node['user_home'])
|
||||
else:
|
||||
item = Item(channel="channelselector", action="getmainlist", viewmode="movie")
|
||||
from platformcode import platformtools
|
||||
undefined_start = platformtools.dialog_ok('Inicio Personalizado', 'No has definido ninguna seccion para mostrar '
|
||||
'en tu inicio', 'Utiliza el menu contextual para definir una')
|
||||
return item
|
||||
|
||||
def set_custom_start(item):
|
||||
logger.info()
|
||||
if os.path.exists(menu_settings_path):
|
||||
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
|
||||
else:
|
||||
menu_node={}
|
||||
parent_item= Item().fromurl(item.parent)
|
||||
parent_item.start=True
|
||||
config.set_setting("custom_start",True)
|
||||
if config.get_setting("news_start"):
|
||||
config.set_setting("news_start", False)
|
||||
menu_node['user_home']=parent_item.tourl()
|
||||
jsontools.update_node(menu_node, 'menu_settings_data.json', "menu")
|
||||
|
||||
def get_start_page():
|
||||
logger.info()
|
||||
|
||||
category = config.get_setting('category').lower()
|
||||
custom_start= config.get_setting("custom_start")
|
||||
#if category != 'definido':
|
||||
if custom_start == False:
|
||||
item = Item(channel="news", action="novedades", extra=category, mode='silent')
|
||||
else:
|
||||
from channels import side_menu
|
||||
item = Item()
|
||||
item = side_menu.check_user_home(item)
|
||||
return item
|
||||
|
||||
|
||||
|
||||
def open_menu(item):
|
||||
main = Main('side_menu.xml', config.get_runtime_path())
|
||||
main.doModal()
|
||||
del main
|
||||
|
||||
|
||||
class Main(xbmcgui.WindowXMLDialog):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.items = []
|
||||
|
||||
def onInit(self):
|
||||
self.setCoordinateResolution(2)
|
||||
self.focus = -1
|
||||
self.buttons = []
|
||||
posx= 0
|
||||
posy= 145
|
||||
space = 30
|
||||
|
||||
selected = 'selected.png'
|
||||
width = 260
|
||||
height = 30
|
||||
textcolor = "0xffffd700"
|
||||
conditional_textcolor = "0xffff3030"
|
||||
shadow = "0xFF000000"
|
||||
offsetx = 30
|
||||
offsety = 0
|
||||
font = 'font25_title'
|
||||
|
||||
if config.get_setting('start_page'):
|
||||
label = 'Inicio'
|
||||
self.button_start = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
|
||||
noFocusTexture='', focusTexture=media_path + selected,
|
||||
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
|
||||
textOffsetY=offsety)
|
||||
self.addControl(self.button_start)
|
||||
self.buttons.append(self.button_start)
|
||||
|
||||
posy += space * 2
|
||||
label = 'Menú Clasico'
|
||||
self.button_alfa = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
|
||||
noFocusTexture='', focusTexture=media_path+selected,
|
||||
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
|
||||
textOffsetY=offsety)
|
||||
self.addControl(self.button_alfa)
|
||||
self.buttons.append(self.button_alfa)
|
||||
|
||||
|
||||
posy += space
|
||||
label = 'Configuracion'
|
||||
self.button_config = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
|
||||
noFocusTexture='', focusTexture=media_path + selected,
|
||||
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
|
||||
textOffsetY=offsety)
|
||||
self.addControl(self.button_config)
|
||||
self.buttons.append(self.button_config)
|
||||
posy += space*2
|
||||
label = 'Peliculas'
|
||||
self.button_peliculas = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
|
||||
alignment=0x00000000, noFocusTexture='',
|
||||
focusTexture=media_path+selected, textColor=textcolor,
|
||||
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
|
||||
self.addControl(self.button_peliculas)
|
||||
self.buttons.append(self.button_peliculas)
|
||||
posy += space
|
||||
label = 'Series'
|
||||
self.button_series = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
|
||||
alignment=0x00000000, noFocusTexture='',
|
||||
focusTexture=media_path+selected, textColor=textcolor,
|
||||
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
|
||||
self.addControl(self.button_series)
|
||||
self.buttons.append(self.button_series)
|
||||
posy += space
|
||||
label = 'Anime'
|
||||
self.button_anime = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
|
||||
noFocusTexture='', focusTexture=media_path+selected,
|
||||
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
|
||||
textOffsetY=offsety)
|
||||
self.addControl(self.button_anime)
|
||||
self.buttons.append(self.button_anime)
|
||||
posy += space
|
||||
label = 'Infantiles'
|
||||
self.button_infantil = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
|
||||
alignment=0x00000000, noFocusTexture='',
|
||||
focusTexture=media_path+selected, textColor=textcolor,
|
||||
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
|
||||
self.addControl(self.button_infantil)
|
||||
self.buttons.append(self.button_infantil)
|
||||
posy += space
|
||||
label = 'Documentales'
|
||||
self.button_docu = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
|
||||
alignment=0x00000000, noFocusTexture='',
|
||||
focusTexture=media_path + selected, textColor=textcolor,
|
||||
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
|
||||
self.addControl(self.button_docu)
|
||||
self.buttons.append(self.button_docu)
|
||||
posy += space
|
||||
|
||||
label = 'Terror'
|
||||
self.button_terror = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
|
||||
alignment=0x00000000, noFocusTexture='',
|
||||
focusTexture=media_path+selected, textColor=textcolor,
|
||||
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
|
||||
self.addControl(self.button_terror)
|
||||
self.buttons.append(self.button_terror)
|
||||
|
||||
posy += space
|
||||
label = 'Latino'
|
||||
self.button_lat = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
|
||||
noFocusTexture='', focusTexture=media_path+selected,
|
||||
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
|
||||
textOffsetY=offsety)
|
||||
self.addControl(self.button_lat)
|
||||
self.buttons.append(self.button_lat)
|
||||
posy += space
|
||||
label = 'Castellano'
|
||||
self.button_cast = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
|
||||
noFocusTexture='', focusTexture=media_path + selected,
|
||||
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
|
||||
textOffsetY=offsety)
|
||||
self.addControl(self.button_cast)
|
||||
self.buttons.append(self.button_cast)
|
||||
posy += space
|
||||
label = 'Torrents'
|
||||
self.button_torrent = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
|
||||
alignment=0x00000000, noFocusTexture='',
|
||||
focusTexture=media_path+selected, textColor=textcolor,
|
||||
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
|
||||
self.addControl(self.button_torrent)
|
||||
self.buttons.append(self.button_torrent)
|
||||
|
||||
start_page_item = get_start_page()
|
||||
if config.get_setting('start_page') and start_page_item.channel =='news':
|
||||
posy += space
|
||||
label = 'Canales Activos'
|
||||
self.button_config = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
|
||||
alignment=0x00000000, noFocusTexture='',
|
||||
focusTexture=media_path+selected, textColor=conditional_textcolor,
|
||||
shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety)
|
||||
self.addControl(self.button_config)
|
||||
self.buttons.append(self.button_config)
|
||||
|
||||
posy += space*2
|
||||
label = 'Buscar'
|
||||
self.button_buscar = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
|
||||
noFocusTexture='', focusTexture=media_path + selected,
|
||||
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
|
||||
textOffsetY=offsety)
|
||||
self.addControl(self.button_buscar)
|
||||
self.buttons.append(self.button_buscar)
|
||||
posy += space
|
||||
label = 'Buscar Actor'
|
||||
self.button_actor = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000,
|
||||
noFocusTexture='', focusTexture=media_path + selected,
|
||||
textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx,
|
||||
textOffsetY=offsety)
|
||||
self.addControl(self.button_actor)
|
||||
self.buttons.append(self.button_actor)
|
||||
|
||||
posy += space
|
||||
label = 'Donde Buscar'
|
||||
self.button_config_search = xbmcgui.ControlButton(posx, posy, width, height, label, font=font,
|
||||
alignment=0x00000000,
|
||||
noFocusTexture='', focusTexture=media_path + selected,
|
||||
textColor=conditional_textcolor, shadowColor=shadow,
|
||||
textOffsetX=offsetx, textOffsetY=offsety)
|
||||
self.addControl(self.button_config_search)
|
||||
self.buttons.append(self.button_config_search)
|
||||
|
||||
|
||||
label=''
|
||||
self.button_close = xbmcgui.ControlButton(260, 0, 1020, 725, label, noFocusTexture='', focusTexture='')
|
||||
self.addControl(self.button_close)
|
||||
|
||||
|
||||
|
||||
def onClick(self, control):
|
||||
new_item=''
|
||||
|
||||
control = self.getControl(control).getLabel()
|
||||
|
||||
if control == 'Inicio':
|
||||
new_item = get_start_page()
|
||||
elif control == u'Menú Clasico':
|
||||
new_item = Item(channel='', action='getmainlist', title='Menú Alfa')
|
||||
elif control == 'Configuracion':
|
||||
new_item = Item(channel='setting', action="settings")
|
||||
elif control == 'Peliculas':
|
||||
new_item = Item(channel='news', action="novedades", extra="peliculas", mode='silent')
|
||||
elif control == 'Series':
|
||||
new_item = Item(channel='news', action="novedades", extra="series", mode='silent')
|
||||
elif control == 'Anime':
|
||||
new_item = Item(channel='news', action="novedades", extra="anime", mode='silent')
|
||||
elif control == 'Infantiles':
|
||||
new_item = Item(channel='news', action="novedades", extra="infantiles", mode='silent')
|
||||
elif control == 'Documentales':
|
||||
new_item = Item(channel='news', action="novedades", extra="documentales", mode='silent')
|
||||
elif control == 'Terror':
|
||||
new_item = Item(channel='news', action="novedades", extra="terror", mode='silent')
|
||||
elif control == 'Castellano':
|
||||
new_item = Item(channel='news', action="novedades", extra="castellano", mode='silent')
|
||||
elif control == 'Latino':
|
||||
new_item = Item(channel='news', action="novedades", extra="latino", mode='silent')
|
||||
elif control == 'Torrents':
|
||||
new_item = Item(channel='news', action="novedades", extra="torrent", mode='silent')
|
||||
elif control == 'Canales Activos':
|
||||
menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu')
|
||||
if 'categoria actual' in menu_node:
|
||||
category = menu_node['categoria actual']
|
||||
new_item = Item(channel='news', action="setting_channel", extra=category, menu=True)
|
||||
elif control == 'Buscar':
|
||||
new_item = Item(channel='search', action="search")
|
||||
elif control == 'Buscar Actor':
|
||||
new_item = Item(channel='tvmoviedb', title="Buscar actor/actriz", action="search_",
|
||||
search={'url': 'search/person', 'language': 'es', 'page': 1}, star=True)
|
||||
elif control == 'Donde Buscar':
|
||||
new_item = Item(channel='search', action="setting_channel")
|
||||
elif control == '':
|
||||
self.close()
|
||||
if new_item !='':
|
||||
self.run_action(new_item)
|
||||
|
||||
|
||||
def onAction(self, action):
|
||||
|
||||
|
||||
if action == ACTION_PREVIOUS_MENU or action == ACTION_GESTURE_SWIPE_LEFT or action == 110 or action == 92:
|
||||
self.close()
|
||||
|
||||
if action == ACTION_MOVE_RIGHT or action == ACTION_MOVE_DOWN:
|
||||
self.focus += 1
|
||||
if self.focus > len(self.buttons)-1:
|
||||
self.focus = 0
|
||||
while True:
|
||||
id_focus = str(self.buttons[self.focus].getId())
|
||||
|
||||
if xbmc.getCondVisibility('[Control.IsVisible(' + id_focus + ')]'):
|
||||
self.setFocus(self.buttons[self.focus])
|
||||
break
|
||||
self.focus += 1
|
||||
|
||||
if action == ACTION_MOVE_LEFT or action == ACTION_MOVE_UP:
|
||||
self.focus -= 1
|
||||
if self.focus < 0:
|
||||
self.focus = len(self.buttons) - 1
|
||||
while True:
|
||||
id_focus = str(self.buttons[self.focus].getId())
|
||||
if xbmc.getCondVisibility('[Control.IsVisible(' + id_focus + ')]'):
|
||||
self.setFocus(self.buttons[self.focus])
|
||||
break
|
||||
self.focus -= 1
|
||||
|
||||
def run_action(self, item):
|
||||
logger.info()
|
||||
if item.menu != True:
|
||||
self.close()
|
||||
xbmc.executebuiltin("Container.update(%s)"%launcher.run(item))
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"id": "unsoloclic",
|
||||
"name": "Unsoloclic",
|
||||
"active": true,
|
||||
"adult": false,
|
||||
"language": ["cast", "lat"],
|
||||
"banner": "unsoloclic.png",
|
||||
"thumbnail": "unsoloclic.png",
|
||||
"categories": [
|
||||
"movie",
|
||||
"tvshow"
|
||||
]
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
import urlparse
|
||||
|
||||
from core import scrapertools
|
||||
from core.item import Item
|
||||
from platformcode import logger
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
item.url = "http://unsoloclic.info"
|
||||
return novedades(item)
|
||||
|
||||
|
||||
def novedades(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
# Descarga la página
|
||||
data = scrapertools.cachePage(item.url)
|
||||
'''
|
||||
<div class="post-45732 post type-post status-publish format-standard hentry category-2012 category-blu-ray category-mkv-hd720p" id="post-45732">
|
||||
<h2 class="title"><a href="http://unsoloclic.info/2012/11/ek-tha-tiger-2012-blu-ray-720p-hd/" rel="bookmark" title="Permanent Link to Pelicula Ek Tha Tiger (2012) BLU-RAY 720p HD">Pelicula Ek Tha Tiger (2012) BLU-RAY 720p HD</a></h2>
|
||||
<div class="postdate"><img src="http://unsoloclic.info/wp-content/themes/TinyWeb/images/date.png" /> noviembre 5th, 2012
|
||||
<!--
|
||||
<img src="http://unsoloclic.info/wp-content/themes/TinyWeb/images/user.png" /> unsoloclic
|
||||
-->
|
||||
</div>
|
||||
<div class="entry">
|
||||
<p><a href="http://unsoloclic.info/2012/11/ek-tha-tiger-2012-blu-ray-720p-hd/" rel="attachment wp-att-45737"><img src="http://unsoloclic.info/wp-content/uploads/2012/11/Ek-Tha-Tiger-2012.jpg" alt="" title="Ek Tha Tiger (2012)" width="500" height="629" class="aligncenter size-full wp-image-45737" /></a></p>
|
||||
<h2 style="text-align: center;"></h2>
|
||||
<div class="readmorecontent">
|
||||
<a class="readmore" href="http://unsoloclic.info/2012/11/ek-tha-tiger-2012-blu-ray-720p-hd/" rel="bookmark" title="Permanent Link to Pelicula Ek Tha Tiger (2012) BLU-RAY 720p HD">Seguir Leyendo</a>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--/post-45732-->
|
||||
'''
|
||||
'''
|
||||
<div class="post-45923 post type-post status-publish format-standard hentry category-2012 category-blu-ray category-comedia category-drama category-mkv category-mkv-hd720p category-romance tag-chris-messina tag-jenna-fischer tag-lee-kirk tag-the-giant-mechanical-man-pelicula tag-topher-grace" id="post-45923">
|
||||
<h2 class="title"><a href="http://unsoloclic.info/2012/12/the-giant-mechanical-man-2012-bluray-720p-hd/" rel="bookmark" title="Permanent Link to The Giant Mechanical Man (2012) BluRay 720p HD">The Giant Mechanical Man (2012) BluRay 720p HD</a></h2>
|
||||
<div class="postdate"><img src="http://unsoloclic.info/wp-content/themes/TinyWeb/images/date.png" /> diciembre 24th, 2012
|
||||
<!--
|
||||
<img src="http://unsoloclic.info/wp-content/themes/TinyWeb/images/user.png" /> deportv
|
||||
-->
|
||||
</div>
|
||||
<div class="entry">
|
||||
<p style="text-align: center;"><a href="http://unsoloclic.info/2012/12/the-giant-mechanical-man-2012-bluray-720p-hd/"><img class="aligncenter size-full wp-image-45924" title="Giant Michanical Man Pelicula Descargar" src="http://unsoloclic.info/wp-content/uploads/2012/12/Giant-Michanical-Man-Pelicula-Descargar.jpg" alt="" width="380" height="500" /></a></p>
|
||||
<p style="text-align: center;">
|
||||
<div class="readmorecontent">
|
||||
<a class="readmore" href="http://unsoloclic.info/2012/12/the-giant-mechanical-man-2012-bluray-720p-hd/" rel="bookmark" title="Permanent Link to The Giant Mechanical Man (2012) BluRay 720p HD">Seguir Leyendo</a>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--/post-45923-->
|
||||
'''
|
||||
patron = '<div class="post[^"]+" id="post-\d+">[^<]+'
|
||||
patron += '<h2 class="title"><a href="([^"]+)" rel="bookmark" title="[^"]+">([^<]+)</a></h2>[^<]+'
|
||||
patron += '<div class="postdate">.*?</div>[^<]+'
|
||||
patron += '<div class="entry">[^<]+'
|
||||
patron += '<p[^<]+<a[^<]+<img.*?src="([^"]+)"'
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for scrapedurl, scrapedtitle, scrapedthumbnail in matches:
|
||||
scrapedplot = ""
|
||||
logger.debug("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]")
|
||||
itemlist.append(Item(channel=item.channel, action="findvideos", title=scrapedtitle, url=scrapedurl,
|
||||
thumbnail=scrapedthumbnail, plot=scrapedplot, folder=True))
|
||||
|
||||
'''
|
||||
<a href="http://unsoloclic.info/page/2/" >« Peliculas anteriores</a>
|
||||
'''
|
||||
patron = '<a href="([^"]+)" >\«\; Peliculas anteriores</a>'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for match in matches:
|
||||
scrapedtitle = ">> Página siguiente"
|
||||
scrapedplot = ""
|
||||
scrapedurl = urlparse.urljoin(item.url, match)
|
||||
scrapedthumbnail = ""
|
||||
logger.debug("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]")
|
||||
itemlist.append(Item(channel=item.channel, action="novedades", title=scrapedtitle, url=scrapedurl,
|
||||
thumbnail=scrapedthumbnail, plot=scrapedplot, folder=True))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
data = scrapertools.cache_page(item.url)
|
||||
itemlist = []
|
||||
|
||||
# <a href="http://67cfb0db.linkbucks.com"><img title="billionuploads" src="http://unsoloclic.info/wp-content/uploads/2012/11/billonuploads2.png" alt="" width="380" height="50" /></a></p>
|
||||
# <a href="http://1bd02d49.linkbucks.com"><img class="colorbox-57103" title="Freakeshare" alt="" src="http://unsoloclic.info/wp-content/uploads/2013/01/freakshare.png" width="390" height="55" /></a></p>
|
||||
patron = '<a href="(http.//[a-z0-9]+.linkbucks.c[^"]+)[^>]+><img.*?title="([^"]+)".*?src="([^"]+)"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
scrapertools.printMatches(matches)
|
||||
for url, servertag, serverthumb in matches:
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, action="play", server="linkbucks", title=servertag + " [linkbucks]", url=url,
|
||||
thumbnail=serverthumb, plot=item.plot, folder=False))
|
||||
|
||||
from core import servertools
|
||||
itemlist.extend(servertools.find_video_items(data=data))
|
||||
for videoitem in itemlist:
|
||||
if videoitem.server != "linkbucks":
|
||||
videoitem.channel = item.channel
|
||||
videoitem.action = "play"
|
||||
videoitem.folder = False
|
||||
videoitem.title = "[" + videoitem.server + "]"
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def play(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
if item.server == "linkbucks":
|
||||
logger.info("Es linkbucks")
|
||||
|
||||
# Averigua el enlace
|
||||
from servers.decrypters import linkbucks
|
||||
location = linkbucks.get_long_url(item.url)
|
||||
logger.info("location=" + location)
|
||||
|
||||
# Extrae la URL de saltar el anuncio en adf.ly
|
||||
if location.startswith("http://adf"):
|
||||
# Averigua el enlace
|
||||
from servers.decrypters import adfly
|
||||
location = adfly.get_long_url(location)
|
||||
logger.info("location=" + location)
|
||||
|
||||
from core import servertools
|
||||
itemlist = servertools.find_video_items(data=location)
|
||||
for videoitem in itemlist:
|
||||
videoitem.channel = item.channel
|
||||
videoitem.folder = False
|
||||
|
||||
else:
|
||||
itemlist.append(item)
|
||||
|
||||
return itemlist
|
||||
@@ -217,7 +217,7 @@ def newest(categoria):
|
||||
return []
|
||||
|
||||
itemlist = scraper(item)
|
||||
if itemlist[-1].title == "» Siguiente »":
|
||||
if itemlist[-1].title == "[COLOR crimson]Siguiente >>[/COLOR]":
|
||||
itemlist.pop()
|
||||
|
||||
# Se captura la excepción, para no interrumpir al canal novedades si un canal falla
|
||||
|
||||
@@ -104,7 +104,7 @@ def get_node_from_file(name_file, node, path=None):
|
||||
if node in dict_data:
|
||||
dict_node = dict_data[node]
|
||||
|
||||
logger.debug("dict_node: %s" % dict_node)
|
||||
#logger.debug("dict_node: %s" % dict_node)
|
||||
|
||||
return dict_node
|
||||
|
||||
|
||||
19
plugin.video.alfa/platformcode/launcher.py
Executable file → Normal file
19
plugin.video.alfa/platformcode/launcher.py
Executable file → Normal file
@@ -14,6 +14,8 @@ from core import videolibrarytools
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from platformcode import platformtools
|
||||
from channelselector import get_thumb
|
||||
|
||||
|
||||
|
||||
def start():
|
||||
@@ -37,8 +39,18 @@ def run(item=None):
|
||||
|
||||
# If no item, this is mainlist
|
||||
else:
|
||||
item = Item(channel="channelselector", action="getmainlist", viewmode="movie")
|
||||
if config.get_setting("start_page"):
|
||||
|
||||
if not config.get_setting("custom_start"):
|
||||
category = config.get_setting("category").lower()
|
||||
item = Item(channel="news", action="novedades", extra=category, mode = 'silent')
|
||||
else:
|
||||
from channels import side_menu
|
||||
item= Item()
|
||||
item = side_menu.check_user_home(item)
|
||||
item.start = True;
|
||||
else:
|
||||
item = Item(channel="channelselector", action="getmainlist", viewmode="movie")
|
||||
logger.info(item.tostring())
|
||||
|
||||
try:
|
||||
@@ -264,6 +276,11 @@ def run(item=None):
|
||||
else:
|
||||
logger.info("Executing channel '%s' method" % item.action)
|
||||
itemlist = getattr(channel, item.action)(item)
|
||||
# if item.start:
|
||||
# menu_icon = get_thumb('menu.png')
|
||||
# menu = Item(channel="channelselector", action="getmainlist", viewmode="movie", thumbnail=menu_icon,
|
||||
# title='Menu')
|
||||
# itemlist.insert(0, menu)
|
||||
platformtools.render_items(itemlist, item)
|
||||
|
||||
except urllib2.URLError, e:
|
||||
|
||||
@@ -18,6 +18,7 @@ import xbmcgui
|
||||
import xbmcplugin
|
||||
from core.item import Item
|
||||
from platformcode import logger
|
||||
from channelselector import get_thumb
|
||||
|
||||
|
||||
def dialog_ok(heading, line1, line2="", line3=""):
|
||||
@@ -95,15 +96,21 @@ def render_items(itemlist, parent_item):
|
||||
"""
|
||||
# Si el itemlist no es un list salimos
|
||||
if not type(itemlist) == list:
|
||||
|
||||
return
|
||||
|
||||
if parent_item.start:
|
||||
menu_icon = get_thumb('menu.png')
|
||||
menu = Item(channel="channelselector", action="getmainlist", viewmode="movie", thumbnail=menu_icon,
|
||||
title='Menu')
|
||||
itemlist.insert(0, menu)
|
||||
|
||||
# Si no hay ningun item, mostramos un aviso
|
||||
if not len(itemlist):
|
||||
itemlist.append(Item(title="No hay elementos que mostrar"))
|
||||
|
||||
# Recorremos el itemlist
|
||||
for item in itemlist:
|
||||
# logger.debug(item)
|
||||
# Si el item no contiene categoria, le ponemos la del item padre
|
||||
if item.category == "":
|
||||
item.category = parent_item.category
|
||||
@@ -181,7 +188,6 @@ def render_items(itemlist, parent_item):
|
||||
if config.get_setting("forceview"):
|
||||
# ...forzamos segun el viewcontent
|
||||
xbmcplugin.setContent(int(sys.argv[1]), parent_item.viewcontent)
|
||||
# logger.debug(parent_item)
|
||||
elif parent_item.channel not in ["channelselector", ""]:
|
||||
# ... o segun el canal
|
||||
xbmcplugin.setContent(int(sys.argv[1]), "movies")
|
||||
@@ -199,9 +205,12 @@ def render_items(itemlist, parent_item):
|
||||
if config.get_setting("forceview"):
|
||||
viewmode_id = get_viewmode_id(parent_item)
|
||||
xbmc.executebuiltin("Container.SetViewMode(%s)" % viewmode_id)
|
||||
if parent_item.mode in ['silent', 'get_cached', 'set_cache','finish']:
|
||||
xbmc.executebuiltin("Container.SetViewMode(500)")
|
||||
|
||||
|
||||
def get_viewmode_id(parent_item):
|
||||
|
||||
# viewmode_json habria q guardarlo en un archivo y crear un metodo para q el user fije sus preferencias en:
|
||||
# user_files, user_movies, user_tvshows, user_season y user_episodes.
|
||||
viewmode_json = {'skin.confluence': {'default_files': 50,
|
||||
@@ -393,7 +402,6 @@ def set_context_commands(item, parent_item):
|
||||
(sys.argv[0], item.clone(channel="favorites", action="addFavourite",
|
||||
from_channel=item.channel,
|
||||
from_action=item.action).tourl())))
|
||||
|
||||
#Buscar en otros canales
|
||||
if item.contentType in ['movie','tvshow']and item.channel != 'search':
|
||||
# Buscar en otros canales
|
||||
@@ -406,8 +414,16 @@ def set_context_commands(item, parent_item):
|
||||
item.clone(channel='search',
|
||||
action="do_search",
|
||||
from_channel=item.channel,
|
||||
contextual=True).tourl())))
|
||||
|
||||
contextual=True).tourl())))
|
||||
#Definir como Pagina de inicio
|
||||
if config.get_setting('start_page'):
|
||||
if item.action not in ['findvideos', 'play']:
|
||||
context_commands.insert(0, ("[COLOR 0xffccff00]Definir como pagina de inicio[/COLOR]",
|
||||
"XBMC.RunPlugin(%s?%s)" % (
|
||||
sys.argv[0], Item(channel='side_menu',
|
||||
action="set_custom_start",
|
||||
parent=item.tourl()).tourl())))
|
||||
|
||||
if item.channel != "videolibrary":
|
||||
# Añadir Serie a la videoteca
|
||||
@@ -468,7 +484,19 @@ def set_context_commands(item, parent_item):
|
||||
context_commands.append(("Super Favourites Menu",
|
||||
"XBMC.RunScript(special://home/addons/plugin.program.super.favourites/LaunchSFMenu.py)"))
|
||||
|
||||
return sorted(context_commands, key=lambda comand: comand[0])
|
||||
|
||||
|
||||
context_commands = sorted(context_commands, key=lambda comand: comand[0])
|
||||
# Menu Rapido
|
||||
context_commands.insert(0,("[COLOR 0xffccff00]<Menú Rápido>[/COLOR]",
|
||||
"XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(channel='side_menu',
|
||||
action="open_menu",
|
||||
parent=parent_item.tourl()).tourl(
|
||||
|
||||
))))
|
||||
return context_commands
|
||||
|
||||
|
||||
|
||||
|
||||
def is_playing():
|
||||
|
||||
BIN
plugin.video.alfa/resources/media/themes/default/thumb_menu.png
Normal file
BIN
plugin.video.alfa/resources/media/themes/default/thumb_menu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
plugin.video.alfa/resources/media/themes/default/thumb_more.png
Normal file
BIN
plugin.video.alfa/resources/media/themes/default/thumb_more.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
10
plugin.video.alfa/resources/settings.xml
Executable file → Normal file
10
plugin.video.alfa/resources/settings.xml
Executable file → Normal file
@@ -37,6 +37,16 @@
|
||||
<setting id="videolibrary_kodi_flag" type="number" label="" default="0" visible="false"/>
|
||||
<setting id="videolibrary_kodi" type="bool" label="Autoconfigurar videoteca de XBMC/Kodi para contenido de Alfa" enable="lt(-1,2)+eq(0,false)" default="false"/>
|
||||
</category>
|
||||
<category label="Pagina de inicio">
|
||||
<setting id="start_page" type="bool" label="Activar pagina de inicio" default="false"/>
|
||||
<setting id="custom_start" type="bool" label="Personalizado (seleccionar desde un canal)" default="false"
|
||||
visible="eq(-1,True)"/>
|
||||
<setting id="news_start" type="bool" label="Mostrar Novedades" default="false" visible="eq(-2,True)"
|
||||
enable="eq(-1,False)+eq(-2,True"/>
|
||||
<setting id="category" type="labelenum" label="Categoria"
|
||||
values="Peliculas|Series|Anime|Infantiles|Documentales|Terror|Castellano|Latino|Torrent"
|
||||
default="Peliculas" visible="eq(-3,True)+eq(-1,True)+eq(-2,False)" enable="eq(-3,True)+eq(-1,True)+(-2,false)"/>
|
||||
</category>
|
||||
<category label="Opciones Visuales">
|
||||
<setting id="icon_set" type="labelenum" label="Set de iconos" values="default|dark" default="default"/>
|
||||
<setting id="infoplus_set" type="labelenum" label="Opción visual Infoplus" values="Sin animación|Con animación" default="Sin animación"/>
|
||||
|
||||
27
plugin.video.alfa/resources/skins/Default/720p/side_menu.xml
Normal file
27
plugin.video.alfa/resources/skins/Default/720p/side_menu.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<window>
|
||||
<coordinates>
|
||||
<left>0</left>
|
||||
<top>0</top>
|
||||
</coordinates>
|
||||
<zorder>1</zorder>
|
||||
<controls>
|
||||
<control type="image">
|
||||
<animation type="WindowOpen" reversible="false">
|
||||
<effect type="slide" start="-200" end="0" time="80"/>
|
||||
</animation>
|
||||
<left>0</left>
|
||||
<top>0</top>
|
||||
<width>260</width>
|
||||
<height>725</height>
|
||||
<texture border="2">side_menu/bg.png</texture>
|
||||
</control>
|
||||
<control type="image">
|
||||
<left>25</left>
|
||||
<top>30</top>
|
||||
<width>200</width>
|
||||
<height>70</height>
|
||||
<texture border="2">side_menu/logo.png</texture>
|
||||
</control>
|
||||
</controls>
|
||||
</window>
|
||||
BIN
plugin.video.alfa/resources/skins/Default/media/side_menu/bg.png
Normal file
BIN
plugin.video.alfa/resources/skins/Default/media/side_menu/bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 351 B |
@@ -31,13 +31,13 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
'Accept-Language': 'en-US,en;q=0.5',
|
||||
'Accept-Encoding': 'gzip, deflate, br', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1',
|
||||
'Cookie': ''}
|
||||
data = httptools.downloadpage(page_url, headers=headers, replace_headers=True).data
|
||||
data = httptools.downloadpage(page_url, cookies=False).data
|
||||
data = data.replace("\n","")
|
||||
cgi_counter = scrapertools.find_single_match(data, """(?is)src=.(https://www.flashx.tv/counter.cgi.*?[^(?:'|")]+)""")
|
||||
cgi_counter = cgi_counter.replace("%0A","").replace("%22","")
|
||||
playnow = scrapertools.find_single_match(data, 'https://www.flashx.tv/dl[^"]+')
|
||||
# Para obtener el f y el fxfx
|
||||
js_fxfx = "https://www." + scrapertools.find_single_match(data.replace("//","/"), """(?is)(flashx.tv/jss/coder.js.*?[^(?:'|")]+)""")
|
||||
js_fxfx = "https://www." + scrapertools.find_single_match(data.replace("//","/"), """(?is)(flashx.tv/js\w+/c\w+.*?[^(?:'|")]+)""")
|
||||
data_fxfx = httptools.downloadpage(js_fxfx).data
|
||||
mfxfx = scrapertools.find_single_match(data_fxfx, 'get.*?({.*?})').replace("'","").replace(" ","")
|
||||
matches = scrapertools.find_multiple_matches(mfxfx, '(\w+):(\w+)')
|
||||
@@ -63,8 +63,8 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
headers['X-Requested-With'] = 'XMLHttpRequest'
|
||||
|
||||
# Obligatorio descargar estos 2 archivos, porque si no, muestra error
|
||||
httptools.downloadpage(coding_url, headers=headers, replace_headers=True)
|
||||
httptools.downloadpage(cgi_counter, headers=headers, replace_headers=True)
|
||||
httptools.downloadpage(coding_url, cookies=False)
|
||||
httptools.downloadpage(cgi_counter, cookies=False)
|
||||
|
||||
try:
|
||||
time.sleep(int(wait_time) + 1)
|
||||
@@ -73,7 +73,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
|
||||
headers.pop('X-Requested-With')
|
||||
headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
||||
data = httptools.downloadpage(playnow, post, headers, replace_headers=True).data
|
||||
data = httptools.downloadpage(playnow, post).data
|
||||
|
||||
# Si salta aviso, se carga la pagina de comprobacion y luego la inicial
|
||||
# LICENSE GPL3, de alfa-addon: https://github.com/alfa-addon/ ES OBLIGATORIO AÑADIR ESTAS LÍNEAS
|
||||
@@ -81,7 +81,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
url_reload = scrapertools.find_single_match(data, 'try to reload the page.*?href="([^"]+)"')
|
||||
try:
|
||||
data = httptools.downloadpage(url_reload, cookies=False).data
|
||||
data = httptools.downloadpage(playnow, post, headers, replace_headers=True).data
|
||||
data = httptools.downloadpage(playnow, post, cookies=False).data
|
||||
# LICENSE GPL3, de alfa-addon: https://github.com/alfa-addon/ ES OBLIGATORIO AÑADIR ESTAS LÍNEAS
|
||||
except:
|
||||
pass
|
||||
@@ -92,15 +92,13 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
try:
|
||||
match = jsunpack.unpack(match)
|
||||
match = match.replace("\\'", "'")
|
||||
|
||||
# {src:\'https://bigcdn.flashx1.tv/cdn25/5k7xmlcjfuvvjuw5lx6jnu2vt7gw4ab43yvy7gmkvhnocksv44krbtawabta/normal.mp4\',type:\'video/mp4\',label:\'SD\',res:360},
|
||||
media_urls = scrapertools.find_multiple_matches(match, "{src:'([^']+)'.*?,label:'([^']+)'")
|
||||
subtitle = ""
|
||||
for media_url, label in media_urls:
|
||||
if media_url.endswith(".srt") and label == "Spanish":
|
||||
try:
|
||||
from core import filetools
|
||||
data = scrapertools.downloadpage(media_url)
|
||||
data = httptools.downloadpage(media_url)
|
||||
subtitle = os.path.join(config.get_data_path(), 'sub_flashx.srt')
|
||||
filetools.write(subtitle, data)
|
||||
except:
|
||||
|
||||
@@ -18,7 +18,8 @@ def test_video_exists(page_url):
|
||||
return False, "[Gamovideo] El archivo no existe o ha sido borrado"
|
||||
if "Video is processing now" in data:
|
||||
return False, "[Gamovideo] El video está procesándose en estos momentos. Inténtelo mas tarde."
|
||||
|
||||
if "File is awaiting for moderation" in data:
|
||||
return False, "[Gamovideo] El video está esperando por moderación."
|
||||
return True, ""
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -9,7 +9,7 @@ from platformcode import logger
|
||||
def test_video_exists(page_url):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
data = httptools.downloadpage(page_url).data
|
||||
if "Not Found" in data:
|
||||
if "Not Found" in data or "File was deleted" in data:
|
||||
return False, "[streamixcloud] El archivo no existe o ha sido borrado"
|
||||
if "Video is processing" in data:
|
||||
return False, "[streamixcloud] El video se está procesando, inténtelo mas tarde"
|
||||
|
||||
@@ -14,7 +14,7 @@ def test_video_exists(page_url):
|
||||
|
||||
if "Streaming link:" in data:
|
||||
return True, ""
|
||||
elif "Unfortunately, the file you want is not available." in data or "Unfortunately, the video you want to see is not available" in data:
|
||||
elif "Unfortunately, the file you want is not available." in data or "Unfortunately, the video you want to see is not available" in data or "This stream doesn" in data:
|
||||
return False, "[Uptobox] El archivo no existe o ha sido borrado"
|
||||
wait = scrapertools.find_single_match(data, "You have to wait ([0-9]+) (minute|second)")
|
||||
if len(wait) > 0:
|
||||
@@ -40,7 +40,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
# Si el archivo tiene enlace de streaming se redirige a upstream
|
||||
if "Streaming link:" in data:
|
||||
page_url = "http://uptostream.com/iframe/" + scrapertools.find_single_match(page_url,
|
||||
'uptobox.com/([a-z0-9]+)')
|
||||
'uptobox.com/([a-z0-9]+)')
|
||||
data = httptools.downloadpage(page_url).data
|
||||
video_urls = uptostream(data)
|
||||
else:
|
||||
@@ -56,17 +56,27 @@ def uptostream(data):
|
||||
subtitle = scrapertools.find_single_match(data, "kind='subtitles' src='//([^']+)'")
|
||||
if subtitle:
|
||||
subtitle = "http://" + subtitle
|
||||
|
||||
video_urls = []
|
||||
patron = "<source src='//([^']+)' type='video/([^']+)' data-res='([^']+)' (?:data-default=\"true\" |)(?:lang='([^']+)'|)"
|
||||
videos1 = []
|
||||
data = data.replace("\\","")
|
||||
patron = 'src":"([^"]+).*?'
|
||||
patron += 'type":"([^"]+).*?'
|
||||
patron += 'res":"([^"]+).*?'
|
||||
patron += 'lang":"([^"]+)'
|
||||
media = scrapertools.find_multiple_matches(data, patron)
|
||||
for url, tipo, res, lang in media:
|
||||
media_url = "http://" + url
|
||||
for media_url, tipo, res, lang in media:
|
||||
videos1.append([media_url, tipo, res, lang])
|
||||
videos1.sort(key=lambda videos1: int(videos1[2]))
|
||||
for x in videos1:
|
||||
media_url = x[0]
|
||||
tipo = x[1]
|
||||
res = x[2]
|
||||
lang = x[3]
|
||||
tipo = tipo.replace("video/","")
|
||||
extension = ".%s (%s)" % (tipo, res)
|
||||
if lang:
|
||||
extension = extension.replace(")", "/%s)" % lang[:3])
|
||||
video_urls.append([extension + " [uptostream]", media_url, 0, subtitle])
|
||||
|
||||
return video_urls
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user