Merge pull request #63 from alfa-jor/master

Fixes in shortcut menu
This commit is contained in:
Alfa
2017-09-06 19:09:55 -04:00
committed by GitHub
18 changed files with 476 additions and 529 deletions
+55 -43
View File
@@ -3,7 +3,9 @@
import re import re
import urlparse import urlparse
from core import httptools
from core import scrapertools from core import scrapertools
from core import servertools
from core.item import Item from core.item import Item
from platformcode import logger from platformcode import logger
@@ -11,7 +13,7 @@ from platformcode import logger
def mainlist(item): def mainlist(item):
logger.info() logger.info()
itemlist = [] itemlist = list()
itemlist.append( itemlist.append(
Item(channel=item.channel, action="ultimos_capitulos", title="Últimos Capitulos", url="http://jkanime.net/")) Item(channel=item.channel, action="ultimos_capitulos", title="Últimos Capitulos", url="http://jkanime.net/"))
itemlist.append(Item(channel=item.channel, action="ultimos", title="Últimos", url="http://jkanime.net/")) itemlist.append(Item(channel=item.channel, action="ultimos", title="Últimos", url="http://jkanime.net/"))
@@ -25,7 +27,7 @@ def mainlist(item):
def ultimos_capitulos(item): def ultimos_capitulos(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = scrapertools.cache_page(item.url) data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data, '<ul class="ratedul">.+?</ul>') data = scrapertools.get_match(data, '<ul class="ratedul">.+?</ul>')
data = data.replace('\t', '') data = data.replace('\t', '')
@@ -43,7 +45,8 @@ def ultimos_capitulos(item):
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]") logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
itemlist.append( itemlist.append(
Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=thumbnail, plot=plot)) Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=thumbnail, plot=plot,
show=scrapedtitle.strip(), fulltitle=title))
return itemlist return itemlist
@@ -67,7 +70,7 @@ def search(item, texto):
def ultimos(item): def ultimos(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = scrapertools.cache_page(item.url) data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data, '<ul class="latestul">(.*?)</ul>') data = scrapertools.get_match(data, '<ul class="latestul">(.*?)</ul>')
patron = '<a href="([^"]+)">([^<]+)<' patron = '<a href="([^"]+)">([^<]+)<'
@@ -90,7 +93,7 @@ def generos(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = scrapertools.cache_page(item.url) data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data, '<div class="genres">(.*?)</div>') data = scrapertools.get_match(data, '<div class="genres">(.*?)</div>')
patron = '<a href="([^"]+)">([^<]+)</a>' patron = '<a href="([^"]+)">([^<]+)</a>'
@@ -114,7 +117,7 @@ def letras(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = scrapertools.cache_page(item.url) data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data, '<ul class="animelet">(.*?)</ul>') data = scrapertools.get_match(data, '<ul class="animelet">(.*?)</ul>')
patron = '<a href="([^"]+)">([^<]+)</a>' patron = '<a href="([^"]+)">([^<]+)</a>'
@@ -138,24 +141,9 @@ def series(item):
logger.info() logger.info()
# Descarga la pagina # Descarga la pagina
data = scrapertools.cache_page(item.url) data = httptools.downloadpage(item.url).data
# Extrae las entradas # Extrae las entradas
'''
<table class="search">
<tr>
<td rowspan="2">
<a href="http://jkanime.net/basilisk-kouga-ninpou-chou/"><img src="http://jkanime.net/assets/images/animes/thumbnail/basilisk-kouga-ninpou-chou.jpg" width="50" /></a>
</td>
<td><a class="titl" href="http://jkanime.net/basilisk-kouga-ninpou-chou/">Basilisk: Kouga Ninpou Chou</a></td>
<td rowspan="2" style="width:50px; text-align:center;">Serie</td>
<td rowspan="2" style="width:50px; text-align:center;" >24 Eps</td>
</tr>
<tr>
<td><p>Basilisk, considerada una de las mejores series del genero ninja, nos narra la historia de dos clanes ninja separados por el odio entre dos familias. Los actuales representantes, Kouga Danjo del clan Kouga y Ogen del clan&#8230; <a class="next" href="http://jkanime.net/basilisk-kouga-ninpou-chou/">seguir leyendo</a></p></td>
</tr>
</table>
'''
patron = '<table class="search[^<]+' patron = '<table class="search[^<]+'
patron += '<tr[^<]+' patron += '<tr[^<]+'
patron += '<td[^<]+' patron += '<td[^<]+'
@@ -181,7 +169,7 @@ def series(item):
itemlist.append( itemlist.append(
Item(channel=item.channel, action="episodios", title=title, url=url, thumbnail=thumbnail, fanart=thumbnail, Item(channel=item.channel, action="episodios", title=title, url=url, thumbnail=thumbnail, fanart=thumbnail,
plot=plot, extra=extra)) plot=plot, extra=extra, show=scrapedtitle.strip()))
try: try:
siguiente = scrapertools.get_match(data, '<a class="listsiguiente" href="([^"]+)" >Resultados Siguientes') siguiente = scrapertools.get_match(data, '<a class="listsiguiente" href="([^"]+)" >Resultados Siguientes')
@@ -198,7 +186,7 @@ def series(item):
return itemlist return itemlist
def getPagesAndEpisodes(data): def get_pages_and_episodes(data):
results = re.findall('href="#pag([0-9]+)">[0-9]+ - ([0-9]+)', data) results = re.findall('href="#pag([0-9]+)">[0-9]+ - ([0-9]+)', data)
if results: if results:
return int(results[-1][0]), int(results[-1][1]) return int(results[-1][0]), int(results[-1][1])
@@ -210,37 +198,30 @@ def episodios(item):
itemlist = [] itemlist = []
# Descarga la pagina # Descarga la pagina
data = scrapertools.cache_page(item.url) data = httptools.downloadpage(item.url).data
scrapedplot = scrapertools.get_match(data, '<meta name="description" content="([^"]+)"/>') scrapedplot = scrapertools.get_match(data, '<meta name="description" content="([^"]+)"/>')
scrapedthumbnail = scrapertools.find_single_match(data, '<div class="separedescrip">.*?src="([^"]+)"') scrapedthumbnail = scrapertools.find_single_match(data, '<div class="separedescrip">.*?src="([^"]+)"')
idserie = scrapertools.get_match(data, "ajax/pagination_episodes/(\d+)/") idserie = scrapertools.get_match(data, "ajax/pagination_episodes/(\d+)/")
logger.info("idserie=" + idserie) logger.info("idserie=" + idserie)
if " Eps" in item.extra and not "Desc" in item.extra: if " Eps" in item.extra and "Desc" not in item.extra:
caps_x = item.extra caps_x = item.extra
caps_x = caps_x.replace(" Eps", "") caps_x = caps_x.replace(" Eps", "")
capitulos = int(caps_x) capitulos = int(caps_x)
paginas = capitulos / 10 + (capitulos % 10 > 0) paginas = capitulos / 10 + (capitulos % 10 > 0)
else: else:
paginas, capitulos = getPagesAndEpisodes(data) paginas, capitulos = get_pages_and_episodes(data)
logger.info("idserie=" + idserie) logger.info("idserie=" + idserie)
for numero in range(1, paginas + 1): for num_pag in range(1, paginas + 1):
numero_pagina = str(numero) numero_pagina = str(num_pag)
headers = [] headers = {"Referer": item.url}
headers.append( data2 = scrapertools.cache_page("http://jkanime.net/ajax/pagination_episodes/%s/%s/" % (idserie, numero_pagina),
["User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"]) headers=headers)
headers.append(["Referer", item.url]) # logger.info("data2=" + data2)
data2 = scrapertools.cache_page(
"http://jkanime.net/ajax/pagination_episodes/" + idserie + "/" + numero_pagina + "/")
logger.info("data2=" + data2)
'''
[{"number":"1","title":"Rose of Versailles - 1"},{"number":"2","title":"Rose of Versailles - 2"},{"number":"3","title":"Rose of Versailles - 3"},{"number":"4","title":"Rose of Versailles - 4"},{"number":"5","title":"Rose of Versailles - 5"},{"number":"6","title":"Rose of Versailles - 6"},{"number":"7","title":"Rose of Versailles - 7"},{"number":"8","title":"Rose of Versailles - 8"},{"number":"9","title":"Rose of Versailles - 9"},{"number":"10","title":"Rose of Versailles - 10"}]
[{"id":"14199","title":"GetBackers - 1","number":"1","animes_id":"122","timestamp":"2012-01-04 16:59:30"},{"id":"14200","title":"GetBackers - 2","number":"2","animes_id":"122","timestamp":"2012-01-04 16:59:30"},{"id":"14201","title":"GetBackers - 3","number":"3","animes_id":"122","timestamp":"2012-01-04 16:59:30"},{"id":"14202","title":"GetBackers - 4","number":"4","animes_id":"122","timestamp":"2012-01-04 16:59:30"},{"id":"14203","title":"GetBackers - 5","number":"5","animes_id":"122","timestamp":"2012-01-04 16:59:30"},{"id":"14204","title":"GetBackers - 6","number":"6","animes_id":"122","timestamp":"2012-01-04 16:59:30"},{"id":"14205","title":"GetBackers - 7","number":"7","animes_id":"122","timestamp":"2012-01-04 16:59:30"},{"id":"14206","title":"GetBackers - 8","number":"8","animes_id":"122","timestamp":"2012-01-04 16:59:30"},{"id":"14207","title":"GetBackers - 9","number":"9","animes_id":"122","timestamp":"2012-01-04 16:59:30"},{"id":"14208","title":"GetBackers - 10","number":"10","animes_id":"122","timestamp":"2012-01-04 16:59:30"}]
'''
patron = '"number"\:"(\d+)","title"\:"([^"]+)"' patron = '"number"\:"(\d+)","title"\:"([^"]+)"'
matches = re.compile(patron, re.DOTALL).findall(data2) matches = re.compile(patron, re.DOTALL).findall(data2)
@@ -253,12 +234,12 @@ def episodios(item):
logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]") logger.debug("title=[" + title + "], url=[" + url + "], thumbnail=[" + thumbnail + "]")
itemlist.append(Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=thumbnail, itemlist.append(Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=thumbnail,
fanart=thumbnail, plot=plot)) fanart=thumbnail, plot=plot, fulltitle=title))
if len(itemlist) == 0: if len(itemlist) == 0:
try: try:
porestrenar = scrapertools.get_match(data, # porestrenar = scrapertools.get_match(data,
'<div[^<]+<span class="labl">Estad[^<]+</span[^<]+<span[^>]+>Por estrenar</span>') # '<div[^<]+<span class="labl">Estad[^<]+</span[^<]+<span[^>]+>Por estrenar</span>')
itemlist.append(Item(channel=item.channel, action="findvideos", title="Serie por estrenar", url="", itemlist.append(Item(channel=item.channel, action="findvideos", title="Serie por estrenar", url="",
thumbnail=scrapedthumbnail, fanart=scrapedthumbnail, plot=scrapedplot, thumbnail=scrapedthumbnail, fanart=scrapedthumbnail, plot=scrapedplot,
server="directo", folder=False)) server="directo", folder=False))
@@ -266,3 +247,34 @@ def episodios(item):
pass pass
return itemlist return itemlist
def findvideos(item):
logger.info()
itemlist = []
data = re.sub(r"\n|\r|\t|\s{2}|-\s", "", httptools.downloadpage(item.url).data)
list_videos = scrapertools.find_multiple_matches(data, '<iframe class="player_conte" src="([^"]+)"')
aux_url = []
index = 1
for e in list_videos:
if e.startswith("https://jkanime.net/jk.php?"):
headers = {"Referer": item.url}
data = httptools.downloadpage(e, headers=headers).data
url = scrapertools.find_single_match(data, '<embed class="player_conte".*?&file=([^\"]+)\"')
if url:
itemlist.append(item.clone(title="Enlace encontrado en server #%s" % index, url=url, action="play"))
index += 1
else:
aux_url.append(e)
itemlist.extend(servertools.find_video_items(data=",".join(aux_url)))
for videoitem in itemlist:
videoitem.fulltitle = item.fulltitle
videoitem.channel = item.channel
videoitem.thumbnail = item.thumbnail
return itemlist
-92
View File
@@ -1,92 +0,0 @@
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# XBMC Plugin
#------------------------------------------------------------
import xbmcgui
import xbmc
from platformcode import config
from core import filetools
main = None
MAIN_MENU = {
"news" : {"label" : "Novedades", "icon" : filetools.join(config.get_runtime_path(),"resources","media","general","default","thumb_news.png"), "order": 0},
"channels" : {"label" : "Canales", "icon" : filetools.join(config.get_runtime_path(),"resources","media","general","default","thumb_channels.png"), "order": 1},
"search" : {"label" : "Buscador", "icon" : filetools.join(config.get_runtime_path(),"resources","media","general","default","thumb_search.png"), "order": 2},
"favorites" : {"label" : "Favoritos", "icon" : filetools.join(config.get_runtime_path(),"resources","media","general","default","thumb_favorites.png"), "order": 3},
"videolibrary" : {"label" : "Videoteca", "icon" : filetools.join(config.get_runtime_path(),"resources","media","general","default","thumb_videolibrary.png"), "order": 4},
"downloads" : {"label" : "Descargas", "icon" : filetools.join(config.get_runtime_path(),"resources","media","general","default","thumb_downloads.png"), "order": 5},
"settings" : {"label" : "Configuración", "icon" : filetools.join(config.get_runtime_path(),"resources","media","general","default","thumb_setting_0.png"), "order": 6},
}
class Main(xbmcgui.WindowXMLDialog):
def __init__( self, *args, **kwargs ):
self.items = []
self.open = kwargs.get("open")
def onInit(self):
self.setCoordinateResolution(2)
if self.open:
for menuentry in MAIN_MENU.keys():
item = xbmcgui.ListItem(MAIN_MENU[menuentry]["label"])
item.setProperty("thumb",str(MAIN_MENU[menuentry]["icon"]))
item.setProperty("identifier",str(menuentry))
item.setProperty("order", str(MAIN_MENU[menuentry]["order"]))
self.items.append(item)
self.items.sort(key=lambda it:int(it.getProperty("order")))
self.getControl(32500).addItems(self.items)
self.setFocusId(32500)
self.open = False
def onClick(self,controlId):
if controlId == 32500:
identifier = self.getControl(32500).getSelectedItem().getProperty("identifier")
if identifier == "news":
self.close()
xbmc.executebuiltin('ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJuZXdzIg0KfQ==")')
elif identifier == "channels":
self.close()
xbmc.executebuiltin('ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAiZ2V0Y2hhbm5lbHR5cGVzIiwgDQogICAgImNoYW5uZWwiOiAiY2hhbm5lbHNlbGVjdG9yIg0KfQ==")')
elif identifier == "search":
self.close()
xbmc.executebuiltin('ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJzZWFyY2giDQp9")')
elif identifier == "favorites":
self.close()
xbmc.executebuiltin('ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJmYXZvcml0ZXMiDQp9")')
elif identifier == "videolibrary":
self.close()
xbmc.executebuiltin('ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJ2aWRlb2xpYnJhcnkiDQp9")')
elif identifier == "downloads":
self.close()
xbmc.executebuiltin('ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJkb3dubG9hZHMiDQp9")')
elif identifier == "settings":
self.close()
xbmc.executebuiltin('ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJzZXR0aW5nIg0KfQ==")')
def onAction(self,action):
#exit
global main
if action.getId() == 92 or action.getId() == 10:
main.close()
del main
if action.getId() == 117:
config.open_settings()
def start(item):
global main
main = Main('script-shortcut-menu.xml',config.get_runtime_path(),open=True)
main.doModal()
+2 -2
View File
@@ -11,7 +11,7 @@ from core import servertools
from core.item import Item from core.item import Item
from platformcode import config, logger from platformcode import config, logger
HOST = "http://seriesblanco.com/" HOST = "https://seriesblanco.com/"
IDIOMAS = {'es': 'Español', 'en': 'Inglés', 'la': 'Latino', 'vo': 'VO', 'vos': 'VOS', 'vosi': 'VOSI', 'otro': 'OVOS'} IDIOMAS = {'es': 'Español', 'en': 'Inglés', 'la': 'Latino', 'vo': 'VO', 'vos': 'VOS', 'vosi': 'VOSI', 'otro': 'OVOS'}
list_idiomas = IDIOMAS.values() list_idiomas = IDIOMAS.values()
CALIDADES = ['SD', 'HDiTunes', 'Micro-HD-720p', 'Micro-HD-1080p', '1080p', '720p'] CALIDADES = ['SD', 'HDiTunes', 'Micro-HD-720p', 'Micro-HD-1080p', '1080p', '720p']
@@ -40,7 +40,7 @@ def mainlist(item):
itemlist.append(Item(channel=item.channel, title="Series por género", action="generos", itemlist.append(Item(channel=item.channel, title="Series por género", action="generos",
url=HOST, thumbnail=thumb_series)) url=HOST, thumbnail=thumb_series))
itemlist.append( itemlist.append(
Item(channel=item.channel, title="Buscar...", action="search", url="https://seriesblanco.com/finder.php", Item(channel=item.channel, title="Buscar...", action="search", url=urlparse.urljoin(HOST, "finder.php"),
thumbnail=thumb_buscar)) thumbnail=thumb_buscar))
itemlist = filtertools.show_option(itemlist, item.channel, list_idiomas, CALIDADES) itemlist = filtertools.show_option(itemlist, item.channel, list_idiomas, CALIDADES)
+1 -1
View File
@@ -10,7 +10,7 @@ from core import servertools
from core.item import Item from core.item import Item
from platformcode import config, logger from platformcode import config, logger
HOST = 'http://seriesdanko.info/' HOST = 'https://seriesdanko.info/'
IDIOMAS = {'es': 'Español', 'la': 'Latino', 'vos': 'VOS', 'vo': 'VO'} IDIOMAS = {'es': 'Español', 'la': 'Latino', 'vos': 'VOS', 'vo': 'VO'}
list_idiomas = IDIOMAS.values() list_idiomas = IDIOMAS.values()
CALIDADES = ['SD', 'MicroHD', 'HD/MKV'] CALIDADES = ['SD', 'MicroHD', 'HD/MKV']
@@ -1,73 +0,0 @@
# -*- coding: utf-8 -*-
import xbmcgui
import xbmcaddon
from platformcode import config
from core import filetools
from threading import Timer
class KeyListener(xbmcgui.WindowXMLDialog):
TIMEOUT = 10
def __new__(cls):
gui_api = tuple(map(int, xbmcaddon.Addon('xbmc.gui').getAddonInfo('version').split('.')))
file_name = "DialogNotification.xml" if gui_api >= (5, 11, 0) else "DialogKaiToast.xml"
return super(KeyListener, cls).__new__(cls, file_name, "")
def __init__(self):
self.key = None
def onInit(self):
try:
self.getControl(401).addLabel("Presiona la tecla a usar para abrir la ventana")
self.getControl(402).addLabel("Tienes %s segundos" % self.TIMEOUT)
except AttributeError:
self.getControl(401).setLabel("Presiona la tecla a usar para abrir la ventana")
self.getControl(402).setLabel("Tienes %s segundos" % self.TIMEOUT)
self.getControl(400).setImage(filetools.join(config.get_runtime_path(),"resources","images","matchcenter","matchcenter.png"))
def onAction(self, action):
code = action.getButtonCode()
self.key = None if code == 0 else str(code)
self.close()
@staticmethod
def record_key():
dialog = KeyListener()
timeout = Timer(KeyListener.TIMEOUT, dialog.close)
timeout.start()
dialog.doModal()
timeout.cancel()
key = dialog.key
del dialog
return key
def start():
tecla_guardada = config.get_setting("keymap_edit", "editor_keymap")
nuevakey = KeyListener().record_key()
if nuevakey and tecla_guardada != nuevakey:
from core import filetools
from platformcode import platformtools
import xbmc
file_xml = "special://profile/keymaps/alfa.xml"
data = '<keymap><global><keyboard><key id="%s">' % nuevakey + 'runplugin(plugin://' \
'plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAic3RhcnQiLCANCiAgICAiY2hhbm5lbCI6ICJtaW5pbWVudSIsIA0KICAgICJpbmZvTGFiZWxzIjoge30NCn0=)</key></keyboard></global></keymap>'
filetools.write(xbmc.translatePath(file_xml), data)
platformtools.dialog_notification("Tecla guardada", "Reinicia Kodi para que se apliquen los cambios")
from core import scrapertools
config.set_setting("keymap_edit", nuevakey, "editor_keymap")
file_idioma = filetools.join(config.get_runtime_path(), 'resources', 'language', 'Spanish', 'strings.xml')
data = filetools.read(file_idioma)
value_xml = scrapertools.find_single_match(data, '<string id="31100">([^<]+)<')
if "tecla" in value_xml:
data = data.replace(value_xml, 'Cambiar tecla/botón para abrir la ventana (Guardada: %s)' % nuevakey)
elif "key" in value_xml:
data = data.replace(value_xml, 'Change key/button to open the window (Saved: %s)' % nuevakey)
else:
data = data.replace(value_xml, 'Cambiamento di chiave/pulsante per aprire la finestra (Salvato: %s)' % nuevakey)
filetools.write(file_idioma, data)
return
@@ -0,0 +1,180 @@
# -*- coding: utf-8 -*-
from threading import Timer
import xbmc
import xbmcaddon
import xbmcgui
from core import filetools
from platformcode import config
class KeyListener(xbmcgui.WindowXMLDialog):
TIMEOUT = 10
def __new__(cls):
gui_api = tuple(map(int, xbmcaddon.Addon('xbmc.gui').getAddonInfo('version').split('.')))
if gui_api >= (5, 11, 0):
filenname = "DialogNotification.xml"
else:
filenname = "DialogKaiToast.xml"
return super(KeyListener, cls).__new__(cls, filenname, "")
def __init__(self):
self.key = None
def onInit(self):
try:
self.getControl(401).addLabel("Presiona la tecla a usar para abrir la ventana")
self.getControl(402).addLabel("Tienes %s segundos" % self.TIMEOUT)
except AttributeError:
self.getControl(401).setLabel("Presiona la tecla a usar para abrir la ventana")
self.getControl(402).setLabel("Tienes %s segundos" % self.TIMEOUT)
def onAction(self, action):
code = action.getButtonCode()
if code == 0:
self.key = None
else:
self.key = str(code)
self.close()
@staticmethod
def record_key():
dialog = KeyListener()
timeout = Timer(KeyListener.TIMEOUT, dialog.close)
timeout.start()
dialog.doModal()
timeout.cancel()
key = dialog.key
del dialog
return key
def set_key():
saved_key = config.get_setting("shortcut_key")
new_key = KeyListener().record_key()
if new_key and saved_key != new_key:
from core import filetools
from platformcode import platformtools
import xbmc
file_xml = "special://profile/keymaps/alfa.xml"
data = '<keymap><global><keyboard><key id="%s">' % new_key + 'runplugin(plugin://' \
'plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAia2V5bWFwIiwNCiAgICAib3BlbiI6IHRydWUNCn0=)</key></keyboard></global></keymap>'
filetools.write(xbmc.translatePath(file_xml), data)
platformtools.dialog_notification("Tecla guardada", "Reinicia Kodi para que se apliquen los cambios")
config.set_setting("shortcut_key", new_key)
# file_idioma = filetools.join(config.get_runtime_path(), 'resources', 'language', 'Spanish', 'strings.xml')
# data = filetools.read(file_idioma)
# value_xml = scrapertools.find_single_match(data, '<string id="31100">([^<]+)<')
# if "tecla" in value_xml:
# data = data.replace(value_xml, 'Cambiar tecla/botón para abrir la ventana (Guardada: %s)' % new_key)
# elif "key" in value_xml:
# data = data.replace(value_xml, 'Change key/button to open the window (Saved: %s)' % new_key)
# else:
# data = data.replace(value_xml,
# 'Cambiamento di chiave/pulsante per aprire la finestra (Salvato: %s)' % new_key)
# filetools.write(file_idioma, data)
return
MAIN_MENU = {
"news": {"label": "Novedades",
"icon": filetools.join(config.get_runtime_path(), "resources", "media", "general", "default",
"thumb_news.png"), "order": 0},
"channels": {"label": "Canales",
"icon": filetools.join(config.get_runtime_path(), "resources", "media", "general", "default",
"thumb_channels.png"), "order": 1},
"search": {"label": "Buscador",
"icon": filetools.join(config.get_runtime_path(), "resources", "media", "general", "default",
"thumb_search.png"), "order": 2},
"favorites": {"label": "Favoritos",
"icon": filetools.join(config.get_runtime_path(), "resources", "media", "general", "default",
"thumb_favorites.png"), "order": 3},
"videolibrary": {"label": "Videoteca",
"icon": filetools.join(config.get_runtime_path(), "resources", "media", "general", "default",
"thumb_videolibrary.png"), "order": 4},
"downloads": {"label": "Descargas",
"icon": filetools.join(config.get_runtime_path(), "resources", "media", "general", "default",
"thumb_downloads.png"), "order": 5},
"settings": {"label": "Configuración",
"icon": filetools.join(config.get_runtime_path(), "resources", "media", "general", "default",
"thumb_setting_0.png"), "order": 6},
}
class Main(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs):
self.items = []
self.open = kwargs.get("open")
def onInit(self):
self.setCoordinateResolution(2)
if self.open:
for menuentry in MAIN_MENU.keys():
item = xbmcgui.ListItem(MAIN_MENU[menuentry]["label"])
item.setProperty("thumb", str(MAIN_MENU[menuentry]["icon"]))
item.setProperty("identifier", str(menuentry))
item.setProperty("order", str(MAIN_MENU[menuentry]["order"]))
self.items.append(item)
self.items.sort(key=lambda it: it.getProperty("order"))
self.getControl(32500).addItems(self.items)
self.setFocusId(32500)
self.open = False
def onClick(self, control_id):
if control_id == 32500:
identifier = self.getControl(32500).getSelectedItem().getProperty("identifier")
if identifier == "news":
self.close()
xbmc.executebuiltin(
'ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJuZXdzIg0KfQ==")')
elif identifier == "channels":
self.close()
xbmc.executebuiltin(
'ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAiZ2V0Y2hhbm5lbHR5cGVzIiwgDQogICAgImNoYW5uZWwiOiAiY2hhbm5lbHNlbGVjdG9yIg0KfQ==")')
elif identifier == "search":
self.close()
xbmc.executebuiltin(
'ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJzZWFyY2giDQp9")')
elif identifier == "favorites":
self.close()
xbmc.executebuiltin(
'ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJmYXZvcml0ZXMiDQp9")')
elif identifier == "videolibrary":
self.close()
xbmc.executebuiltin(
'ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJ2aWRlb2xpYnJhcnkiDQp9")')
elif identifier == "downloads":
self.close()
xbmc.executebuiltin(
'ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJkb3dubG9hZHMiDQp9")')
elif identifier == "settings":
self.close()
xbmc.executebuiltin(
'ActivateWindow(10025, "plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAibWFpbmxpc3QiLCANCiAgICAiY2hhbm5lbCI6ICJzZXR0aW5nIg0KfQ==")')
config.set_setting("shortcut_flag", "")
def onAction(self, action):
# exit
if action.getId() in [xbmcgui.ACTION_PREVIOUS_MENU, xbmcgui.ACTION_NAV_BACK]:
# main.close()
self.close()
config.set_setting("shortcut_flag", "")
if action.getId() == xbmcgui.ACTION_CONTEXT_MENU:
config.open_settings()
def open_shortcut_menu():
if config.get_setting("shortcut_flag") != "open":
main = Main('ShortCutMenu.xml', config.get_runtime_path(), open=True)
config.set_setting("shortcut_flag", "open")
main.doModal()
del main
+8 -5
View File
@@ -42,17 +42,13 @@ def run(item=None):
logger.info(item.tostring()) logger.info(item.tostring())
try: try:
if item.action == "editor_keymap":
from platformcode import editor_keymap
return editor_keymap.start()
# If item has no action, stops here # If item has no action, stops here
if item.action == "": if item.action == "":
logger.info("Item sin accion") logger.info("Item sin accion")
return return
# Action for main menu in channelselector # Action for main menu in channelselector
if item.action == "getmainlist": elif item.action == "getmainlist":
import channelselector import channelselector
# # Check for updates only on first screen # # Check for updates only on first screen
@@ -124,6 +120,13 @@ def run(item=None):
play_from_library(item) play_from_library(item)
return return
elif item.action == "keymap":
from platformcode import keymaptools
if item.open:
return keymaptools.open_shortcut_menu()
else:
return keymaptools.set_key()
# Action in certain channel specified in "action" and "channel" parameters # Action in certain channel specified in "action" and "channel" parameters
else: else:
+1 -1
View File
@@ -51,6 +51,6 @@
<setting id="extended_info" type="bool" label="Mostrar opción ExtendedInfo (Necesario addon externo):" default="false"/> <setting id="extended_info" type="bool" label="Mostrar opción ExtendedInfo (Necesario addon externo):" default="false"/>
<setting label="Botones/Teclas de acceso (Cambios requieren reiniciar Kodi)" type="lsep"/> <setting label="Botones/Teclas de acceso (Cambios requieren reiniciar Kodi)" type="lsep"/>
<setting id="button_keymap" type="action" label="31100" action="RunPlugin(plugin://plugin.video.alfa/?ewogICAgImFjdGlvbiI6ICJlZGl0b3Jfa2V5bWFwIiwgCiAgICAiaW5mb0xhYmVscyI6IHt9Cn0%3D)" /> <setting id="shortcut_key" type="action" label="31100" action="RunPlugin(plugin://plugin.video.alfa/?ew0KICAgICJhY3Rpb24iOiAia2V5bWFwIg0KfQ==)" />
</category> </category>
</settings> </settings>
@@ -20,14 +20,14 @@
<top>0</top> <top>0</top>
<width>969</width> <width>969</width>
<height>283</height> <height>283</height>
<texture border="2">Shorcut/dialog-bg-solid.png</texture> <texture border="2">Shortcut/dialog-bg-solid.png</texture>
</control> </control>
<control type="image"> <control type="image">
<left>0</left> <left>0</left>
<top>0</top> <top>0</top>
<width>969</width> <width>969</width>
<height>70</height> <height>70</height>
<texture colordiffuse="FF12B2E7" border="2">Shorcut/white70.png</texture> <texture colordiffuse="FF12B2E7" border="2">Shortcut/white70.png</texture>
</control> </control>
<control type="label" id="30000"> <control type="label" id="30000">
<textoffsetx>70</textoffsetx> <textoffsetx>70</textoffsetx>
@@ -71,10 +71,10 @@
<texturenofocus>-</texturenofocus> <texturenofocus>-</texturenofocus>
<label></label> <label></label>
<animation effect="slide" end="-70,0" time="0" condition="true">Conditional</animation> <animation effect="slide" end="-70,0" time="0" condition="true">Conditional</animation>
<textureradioofffocus colordiffuse="EEFFFFFF">Shorcut/close.png</textureradioofffocus> <textureradioofffocus colordiffuse="EEFFFFFF">Shortcut/close.png</textureradioofffocus>
<textureradiooffnofocus colordiffuse="EEFFFFFF">Shorcut/logo.png</textureradiooffnofocus> <textureradiooffnofocus colordiffuse="EEFFFFFF">Shortcut/logo.png</textureradiooffnofocus>
<textureradioonfocus colordiffuse="EEFFFFFF">Shorcut/close.png</textureradioonfocus> <textureradioonfocus colordiffuse="EEFFFFFF">Shortcut/close.png</textureradioonfocus>
<textureradioonnofocus colordiffuse="EEFFFFFF">Shorcut/logo.png</textureradioonnofocus> <textureradioonnofocus colordiffuse="EEFFFFFF">Shortcut/logo.png</textureradioonnofocus>
<onclick>Action(close)</onclick> <onclick>Action(close)</onclick>
<onup>32500</onup> <onup>32500</onup>
<ondown>32500</ondown> <ondown>32500</ondown>
@@ -86,7 +86,7 @@
<top>50</top> <top>50</top>
<width>1011</width> <width>1011</width>
<height>253</height> <height>253</height>
<texture border="40">Shorcut/dialogbutton-nofo.png</texture> <texture border="40">Shortcut/dialogbutton-nofo.png</texture>
</control> </control>
<control type="list" id="32500"> <control type="list" id="32500">
<left>-139</left> <left>-139</left>
@@ -107,14 +107,14 @@
<left>10</left> <left>10</left>
<width>347</width> <width>347</width>
<height>260</height> <height>260</height>
<texture border="40">Shorcut/button-nofo.png</texture> <texture border="40">Shortcut/button-nofo.png</texture>
</control> </control>
<control type="image"> <control type="image">
<left>30</left> <left>30</left>
<top>149</top> <top>149</top>
<width>306</width> <width>306</width>
<height>75</height> <height>75</height>
<texture colordiffuse="60FFFFFF">Shorcut/black.png</texture> <texture colordiffuse="60FFFFFF">Shortcut/black.png</texture>
</control> </control>
<control type="image"> <control type="image">
<left>95</left> <left>95</left>
@@ -158,14 +158,14 @@
<control type="image"> <control type="image">
<width>340</width> <width>340</width>
<height>245</height> <height>245</height>
<texture border="40">Shorcut/button-nofo.png</texture> <texture border="40">Shortcut/button-nofo.png</texture>
<animation effect="fade" start="0" end="100" time="0">Unfocus</animation> <animation effect="fade" start="0" end="100" time="0">Unfocus</animation>
<animation effect="fade" start="100" end="0" time="0">Focus</animation> <animation effect="fade" start="100" end="0" time="0">Focus</animation>
</control> </control>
<control type="image"> <control type="image">
<width>340</width> <width>340</width>
<height>237</height> <height>237</height>
<texture border="40" colordiffuse="FF12B2E7">Shorcut/button-fo.png</texture> <texture border="40" colordiffuse="FF12B2E7">Shortcut/button-fo.png</texture>
<animation effect="fade" start="100" end="0" time="0">Unfocus</animation> <animation effect="fade" start="100" end="0" time="0">Unfocus</animation>
</control> </control>
<control type="image"> <control type="image">
@@ -181,7 +181,7 @@
<top>149</top> <top>149</top>
<width>298</width> <width>298</width>
<height>75</height> <height>75</height>
<texture colordiffuse="60FFFFFF">Shorcut/black.png</texture> <texture colordiffuse="60FFFFFF">Shortcut/black.png</texture>
</control> </control>
<control type="image"> <control type="image">
<left>95</left> <left>95</left>
@@ -210,9 +210,9 @@
<top>280</top> <top>280</top>
<width>972</width> <width>972</width>
<height>15</height> <height>15</height>
<texturesliderbackground colordiffuse="FFE6E6E6">Shorcut/white.png</texturesliderbackground> <texturesliderbackground colordiffuse="FFE6E6E6">Shortcut/white.png</texturesliderbackground>
<texturesliderbar colordiffuse="FF12D2E7">Shorcut/white.png</texturesliderbar> <texturesliderbar colordiffuse="FF12D2E7">Shortcut/white.png</texturesliderbar>
<texturesliderbarfocus colordiffuse="FF12B2E7">Shorcut/white.png</texturesliderbarfocus> <texturesliderbarfocus colordiffuse="FF12B2E7">Shortcut/white.png</texturesliderbarfocus>
<textureslidernib>-</textureslidernib> <textureslidernib>-</textureslidernib>
<textureslidernibfocus>-</textureslidernibfocus> <textureslidernibfocus>-</textureslidernibfocus>
<showonepage>false</showonepage> <showonepage>false</showonepage>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 874 B

After

Width:  |  Height:  |  Size: 874 B

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 838 B

After

Width:  |  Height:  |  Size: 838 B

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 167 B

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 177 B

-60
View File
@@ -1,60 +0,0 @@
{
"active": true,
"changes": [
{
"date": "26/05/2016",
"description": "Versión incial"
}
],
"find_videos": {
"ignore_urls": [],
"patterns": [
{
"pattern": "(https://animeflv.net/embed_izanagi.php\\?key=.+?),",
"url": "\\1"
},
{
"pattern": "(https://s1.animeflv.com/gdrive.php?id=.+?)\\\\\\\\",
"url": "\\1"
},
{
"pattern": "(http://www.animeid..{2,3}/embed/.+?/)",
"url": "\\1"
},
{
"pattern": "(https://jkanime.net/jk.php\\?u=stream/jkmedia.+?)\\s",
"url": "\\1"
}
]
},
"free": true,
"id": "redirects",
"name": "redirects",
"settings": [
{
"default": false,
"enabled": true,
"id": "black_list",
"label": "Incluir en lista negra",
"type": "bool",
"visible": true
},
{
"default": 0,
"enabled": true,
"id": "favorites_servers_list",
"label": "Incluir en lista de favoritos",
"lvalues": [
"No",
"1",
"2",
"3",
"4",
"5"
],
"type": "list",
"visible": false
}
],
"version": 1
}
-23
View File
@@ -1,23 +0,0 @@
# -*- coding: utf-8 -*-
import re
import urllib2
from core import scrapertools
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
video_urls = []
if 'jkanime' in page_url:
request_headers = {
"Accept-Language": "en-US,en;q=0.5",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Connection": "keep-alive"
}
jk_url = page_url.replace("/jk.php?u=stream/", "/stream/")
request = urllib2.Request(jk_url, headers=request_headers)
response = urllib2.urlopen(request)
video_urls.append([".mp4 [redirects]", response.geturl()])
return video_urls