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"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.video.alfa" name="Alfa" version="2.4.15" provider-name="Alfa Addon">
|
<addon id="plugin.video.alfa" name="Alfa" version="2.4.16" provider-name="Alfa Addon">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.1.0"/>
|
<import addon="xbmc.python" version="2.1.0"/>
|
||||||
<import addon="script.module.libtorrent" optional="true"/>
|
<import addon="script.module.libtorrent" optional="true"/>
|
||||||
@@ -19,12 +19,9 @@
|
|||||||
</assets>
|
</assets>
|
||||||
<news>[B]Estos son los cambios para esta versión:[/B]
|
<news>[B]Estos son los cambios para esta versión:[/B]
|
||||||
[COLOR green][B]Canales agregados y arreglos[/B][/COLOR]
|
[COLOR green][B]Canales agregados y arreglos[/B][/COLOR]
|
||||||
» hdfull » pelisplus
|
» userscloud » hdfull
|
||||||
» cinemahd » cinecalidad
|
» peliculasgratis
|
||||||
» peliculasgratis » pelisplusco
|
|
||||||
» ultrapeliculashd » thevideome
|
|
||||||
¤ arreglos internos
|
¤ arreglos internos
|
||||||
[COLOR green]Gracias a [B][COLOR yellow]atomizasser[/COLOR][/B] por su colaboración en esta versión[/COLOR]
|
|
||||||
</news>
|
</news>
|
||||||
<description lang="es">Navega con Kodi por páginas web para ver sus videos de manera fácil.</description>
|
<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>
|
<summary lang="en">Browse web pages using Kodi</summary>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from core.item import Item
|
|||||||
from platformcode import config, logger
|
from platformcode import config, logger
|
||||||
from platformcode import platformtools
|
from platformcode import platformtools
|
||||||
|
|
||||||
host = "https://hdfull.tv"
|
host = "https://hdfull.me"
|
||||||
|
|
||||||
if config.get_setting('hdfulluser', 'hdfull'):
|
if config.get_setting('hdfulluser', 'hdfull'):
|
||||||
account = True
|
account = True
|
||||||
@@ -39,23 +39,10 @@ def login():
|
|||||||
|
|
||||||
httptools.downloadpage(host, post=post)
|
httptools.downloadpage(host, post=post)
|
||||||
|
|
||||||
def set_host():
|
|
||||||
global host
|
|
||||||
logger.info()
|
|
||||||
|
|
||||||
hosts_list= [host, 'https://hdfull.me']
|
|
||||||
for url in hosts_list:
|
|
||||||
data = httptools.downloadpage(url, only_headers=True)
|
|
||||||
if data.sucess:
|
|
||||||
host = url
|
|
||||||
break
|
|
||||||
|
|
||||||
def mainlist(item):
|
def mainlist(item):
|
||||||
logger.info()
|
logger.info()
|
||||||
|
|
||||||
itemlist = []
|
itemlist = []
|
||||||
set_host()
|
|
||||||
|
|
||||||
itemlist.append(Item(channel=item.channel, action="menupeliculas", title="Películas", url=host, folder=True))
|
itemlist.append(Item(channel=item.channel, action="menupeliculas", title="Películas", url=host, folder=True))
|
||||||
itemlist.append(Item(channel=item.channel, action="menuseries", title="Series", url=host, folder=True))
|
itemlist.append(Item(channel=item.channel, action="menuseries", title="Series", url=host, folder=True))
|
||||||
itemlist.append(Item(channel=item.channel, action="search", title="Buscar..."))
|
itemlist.append(Item(channel=item.channel, action="search", title="Buscar..."))
|
||||||
@@ -355,14 +342,14 @@ def fichas(item):
|
|||||||
if str != "": title += str
|
if str != "": title += str
|
||||||
|
|
||||||
if item.title == "Buscar...":
|
if item.title == "Buscar...":
|
||||||
tag_type = scrapertools.get_match(url, 'l.tv/([^/]+)/')
|
bus = host[-4:]
|
||||||
|
tag_type = scrapertools.find_single_match(url, '%s/([^/]+)/' %bus)
|
||||||
title += " - [COLOR blue]" + tag_type.capitalize() + "[/COLOR]"
|
title += " - [COLOR blue]" + tag_type.capitalize() + "[/COLOR]"
|
||||||
|
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
Item(channel=item.channel, action=action, title=title, url=url, fulltitle=title, thumbnail=thumbnail,
|
Item(channel=item.channel, action=action, title=title, url=url, fulltitle=title, thumbnail=thumbnail,
|
||||||
show=show, folder=True, contentType=contentType, contentTitle=contentTitle,
|
show=show, folder=True, contentType=contentType, contentTitle=contentTitle,
|
||||||
language =language, infoLabels=infoLabels))
|
language =language, infoLabels=infoLabels))
|
||||||
|
|
||||||
## Paginación
|
## Paginación
|
||||||
next_page_url = scrapertools.find_single_match(data, '<a href="([^"]+)">.raquo;</a>')
|
next_page_url = scrapertools.find_single_match(data, '<a href="([^"]+)">.raquo;</a>')
|
||||||
if next_page_url != "":
|
if next_page_url != "":
|
||||||
@@ -760,7 +747,7 @@ def agrupa_datos(data):
|
|||||||
|
|
||||||
|
|
||||||
def extrae_idiomas(bloqueidiomas):
|
def extrae_idiomas(bloqueidiomas):
|
||||||
logger.info("idiomas=" + bloqueidiomas)
|
logger.info()
|
||||||
language=[]
|
language=[]
|
||||||
textoidiomas = ''
|
textoidiomas = ''
|
||||||
patronidiomas = '([a-z0-9]+).png"'
|
patronidiomas = '([a-z0-9]+).png"'
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "maxipelis",
|
|
||||||
"name": "Maxipelis",
|
|
||||||
"active": true,
|
|
||||||
"adult": false,
|
|
||||||
"language": ["cast", "lat"],
|
|
||||||
"thumbnail": "http://www.maxipelis.net/wp-content/uploads/2016/12/applogo.png",
|
|
||||||
"banner": "",
|
|
||||||
"categories": [
|
|
||||||
"movie"
|
|
||||||
],
|
|
||||||
"settings": [
|
|
||||||
{
|
|
||||||
"id": "include_in_global_search",
|
|
||||||
"type": "bool",
|
|
||||||
"label": "Incluir en busqueda global",
|
|
||||||
"default": true,
|
|
||||||
"enabled": true,
|
|
||||||
"visible": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Alfa
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
import urlparse,urllib2,urllib,re
|
|
||||||
import os, sys
|
|
||||||
|
|
||||||
from core import jsontools as json
|
|
||||||
from core import scrapertools
|
|
||||||
from core import servertools
|
|
||||||
from core.item import Item
|
|
||||||
from platformcode import config, logger
|
|
||||||
from core import httptools
|
|
||||||
from core import tmdb
|
|
||||||
|
|
||||||
host = 'http://www.maxipelis.net'
|
|
||||||
|
|
||||||
|
|
||||||
def mainlist(item):
|
|
||||||
logger.info()
|
|
||||||
itemlist = []
|
|
||||||
itemlist.append(Item(channel=item.channel, title="Novedades" , action="peliculas", url=host + "/pelicula"))
|
|
||||||
|
|
||||||
itemlist.append(Item(channel=item.channel, title="Categorias" , action="categorias", url=host))
|
|
||||||
itemlist.append(Item(channel=item.channel, title="Buscar", action="search"))
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
|
|
||||||
def search(item, texto):
|
|
||||||
logger.info()
|
|
||||||
texto = texto.replace(" ", "+")
|
|
||||||
item.url = host + "/?s=%s" % texto
|
|
||||||
|
|
||||||
try:
|
|
||||||
return sub_search(item)
|
|
||||||
|
|
||||||
except:
|
|
||||||
import sys
|
|
||||||
for line in sys.exc_info():
|
|
||||||
logger.error("%s" % line)
|
|
||||||
return []
|
|
||||||
|
|
||||||
|
|
||||||
def sub_search(item):
|
|
||||||
logger.info()
|
|
||||||
itemlist = []
|
|
||||||
data = httptools.downloadpage(item.url).data
|
|
||||||
data = re.sub(r"\n|\r|\t| |<br>", "", data)
|
|
||||||
|
|
||||||
patron = '<div class="thumbnail animation-2"> <a href="([^"]+)"> <img src="([^"]+)" alt="(.*?)" />.*?'
|
|
||||||
patron +='<div class="contenido"><p>(.*?)</p>'
|
|
||||||
matches = scrapertools.find_multiple_matches(data, patron)
|
|
||||||
|
|
||||||
for url,img,name,plot in matches:
|
|
||||||
itemlist.append(item.clone(channel=item.channel, action="findvideos", title=name, url=url, plot=plot,
|
|
||||||
thumbnail=img))
|
|
||||||
|
|
||||||
paginacion = scrapertools.find_single_match(data, '<div class=\'resppages\'><a href="([^"]+)" ><span class="'
|
|
||||||
'icon-chevron-right"></span>')
|
|
||||||
|
|
||||||
if paginacion:
|
|
||||||
itemlist.append(Item(channel=item.channel, action="sub_search", title="Next page >>" , url=paginacion))
|
|
||||||
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
def categorias(item):
|
|
||||||
logger.info()
|
|
||||||
itemlist = []
|
|
||||||
data = httptools.downloadpage(item.url).data
|
|
||||||
|
|
||||||
patron = '<li class="cat-item"><a href="([^"]+)".*?>(.*?)</a>'
|
|
||||||
matches = re.compile(patron,re.DOTALL).findall(data)
|
|
||||||
scrapertools.printMatches(matches)
|
|
||||||
|
|
||||||
for scrapedurl,scrapedtitle in matches:
|
|
||||||
scrapedplot = ""
|
|
||||||
scrapedthumbnail = ""
|
|
||||||
itemlist.append( Item(channel=item.channel, action="peliculas", title=scrapedtitle , url=host + scrapedurl,
|
|
||||||
thumbnail=scrapedthumbnail , plot=scrapedplot))
|
|
||||||
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
|
|
||||||
def peliculas(item):
|
|
||||||
logger.info()
|
|
||||||
itemlist = []
|
|
||||||
data = httptools.downloadpage(item.url).data
|
|
||||||
patron = '<div class="poster">.*?src="(.*?)" alt="(.*?)">.*?'
|
|
||||||
patron += '"quality">(.*?)<.*?href="(.*?)".*?<span>(\d{4}).*?"texto">(.*?)<.*?'
|
|
||||||
matches = re.compile(patron,re.DOTALL).findall(data)
|
|
||||||
|
|
||||||
for scrapedthumbnail, scrapedtitle, scrapedquality, scrapedurl, scrapedyear, scrapedplot in matches:
|
|
||||||
url = scrapedurl
|
|
||||||
thumbnail = scrapedthumbnail
|
|
||||||
contentTitle = scrapedtitle
|
|
||||||
quality = scrapedquality
|
|
||||||
year = scrapedyear
|
|
||||||
plot = scrapedplot
|
|
||||||
if quality == "" or year=="" :
|
|
||||||
title = contentTitle
|
|
||||||
else:
|
|
||||||
title = contentTitle + " (" + year + ") " + "[COLOR red]" + quality + "[/COLOR]"
|
|
||||||
|
|
||||||
new_item = Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=thumbnail, plot=plot,
|
|
||||||
contentTitle = contentTitle , infoLabels={'year':year} )
|
|
||||||
|
|
||||||
#if year:
|
|
||||||
# tmdb.set_infoLabels_item(new_item)
|
|
||||||
itemlist.append(new_item)
|
|
||||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
|
||||||
try:
|
|
||||||
patron = '<a href="([^"]+)" ><span class="icon-chevron-right"></span></a></div>'
|
|
||||||
next_page = re.compile(patron,re.DOTALL).findall(data)
|
|
||||||
itemlist.append( Item(channel=item.channel , action="peliculas" , title="Siguiente >>" , text_color="yellow",
|
|
||||||
url=next_page[0]))
|
|
||||||
|
|
||||||
except: pass
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
|
|
||||||
def findvideos(item):
|
|
||||||
logger.info()
|
|
||||||
itemlist = []
|
|
||||||
|
|
||||||
data = httptools.downloadpage(item.url).data
|
|
||||||
|
|
||||||
patron = '<tr><td> <a class="link_a" href="([^"]+)".*?<td> (.*?)</td><td> (.*?)</td><td> (.*?)</td>'
|
|
||||||
matches = scrapertools.find_multiple_matches(data, patron)
|
|
||||||
|
|
||||||
for url, server, calidad, idioma in matches:
|
|
||||||
server = servertools.get_server_from_url(url)
|
|
||||||
title = '%s [%s] [%s] [%s]' % (item.contentTitle, server, calidad, idioma)
|
|
||||||
itemlist.append(item.clone(action="play", title=title, fulltitle = item.title, url=url, language = idioma,
|
|
||||||
contentTitle = item.contentTitle, quality = calidad, server = server))
|
|
||||||
|
|
||||||
if config.get_videolibrary_support() and len(itemlist) > 0 and item.extra !='findvideos' :
|
|
||||||
itemlist.append(Item(channel=item.channel, title='[COLOR yellow]Agregar esta pelicula a la Videoteca[/COLOR]',
|
|
||||||
url=item.url, action="add_pelicula_to_library", extra="findvideos",
|
|
||||||
contentTitle = item.contentTitle))
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
# def play(item):
|
|
||||||
# logger.info()
|
|
||||||
# itemlist = servertools.find_video_items(data=item.url)
|
|
||||||
#
|
|
||||||
# for videoitem in itemlist:
|
|
||||||
# videoitem.title = item.title
|
|
||||||
# videoitem.fulltitle = item.fulltitle
|
|
||||||
# videoitem.thumbnail = item.thumbnail
|
|
||||||
# videoitem.channel = item.channel
|
|
||||||
# videoitem.
|
|
||||||
# return itemlist
|
|
||||||
@@ -46,20 +46,20 @@ def mainlist(item):
|
|||||||
url= host,
|
url= host,
|
||||||
thumbnail="http://imgur.com/fN2p6qH.png", fanart="http://imgur.com/b8OuBR2.jpg",
|
thumbnail="http://imgur.com/fN2p6qH.png", fanart="http://imgur.com/b8OuBR2.jpg",
|
||||||
contentType="movie"))
|
contentType="movie"))
|
||||||
# itemlist.append(itemlist[-1].clone(title="[COLOR lightskyblue][B]Series[/B][/COLOR]", action="scraper",
|
itemlist.append(itemlist[-1].clone(title="[COLOR lightskyblue][B]Series[/B][/COLOR]", action="scraper",
|
||||||
# url= host + "/lista-de-series",
|
url= host + "/lista-de-series",
|
||||||
# thumbnail="http://imgur.com/Jia27Uc.png", fanart="http://imgur.com/b8OuBR2.jpg",
|
thumbnail="http://imgur.com/Jia27Uc.png", fanart="http://imgur.com/b8OuBR2.jpg",
|
||||||
# contentType="tvshow"))
|
contentType="tvshow"))
|
||||||
itemlist.append(itemlist[-1].clone(title="[COLOR lightskyblue][B]Buscar[/B][/COLOR]",
|
itemlist.append(itemlist[-1].clone(title="[COLOR lightskyblue][B]Buscar[/B][/COLOR]", action = "",
|
||||||
thumbnail="http://imgur.com/mwTwfN7.png", fanart="http://imgur.com/b8OuBR2.jpg"))
|
thumbnail="http://imgur.com/mwTwfN7.png", fanart="http://imgur.com/b8OuBR2.jpg"))
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
itemlist[-1].clone(title="[COLOR lightskyblue][B] Buscar Película[/B][/COLOR]", action="search", url="",
|
itemlist[-1].clone(title="[COLOR lightskyblue][B] Buscar Película[/B][/COLOR]", action="search", url="",
|
||||||
thumbnail="http://imgur.com/mwTwfN7.png", fanart="http://imgur.com/b8OuBR2.jpg",
|
thumbnail="http://imgur.com/mwTwfN7.png", fanart="http://imgur.com/b8OuBR2.jpg",
|
||||||
contentType="movie"))
|
contentType="movie"))
|
||||||
# itemlist.append(
|
itemlist.append(
|
||||||
# itemlist[-1].clone(title="[COLOR lightskyblue][B] Buscar Serie[/B][/COLOR]", action="search", url="",
|
itemlist[-1].clone(title="[COLOR lightskyblue][B] Buscar Serie[/B][/COLOR]", action="search", url="",
|
||||||
# thumbnail="http://imgur.com/mwTwfN7.png", fanart="http://imgur.com/b8OuBR2.jpg",
|
thumbnail="http://imgur.com/mwTwfN7.png", fanart="http://imgur.com/b8OuBR2.jpg",
|
||||||
# contentType="tvshow"))
|
contentType="tvshow"))
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
@@ -119,11 +119,11 @@ def scraper(item):
|
|||||||
patron += 'alt="([^"]+)".*?'
|
patron += 'alt="([^"]+)".*?'
|
||||||
patron += '">([^<]+)<.*?'
|
patron += '">([^<]+)<.*?'
|
||||||
patron += '<div class="l">(.*?)<\/a><h3>.*?'
|
patron += '<div class="l">(.*?)<\/a><h3>.*?'
|
||||||
#patron += '<\/a><\/h3> <span>(.*?)<'
|
patron += '<\/a><\/h3> <span>(.*?)<'
|
||||||
action = "findvideos"
|
action = "findvideos"
|
||||||
matches = scrapertools.find_multiple_matches(bloque_enlaces, patron)
|
matches = scrapertools.find_multiple_matches(bloque_enlaces, patron)
|
||||||
for url, thumb, title, quality, check_idioma in matches:
|
for url, thumb, title, quality, check_idioma, year in matches:
|
||||||
#year = year.strip()
|
year = year.strip()
|
||||||
title_fan = title
|
title_fan = title
|
||||||
title_item = "[COLOR cornflowerblue][B]" + title + "[/B][/COLOR]"
|
title_item = "[COLOR cornflowerblue][B]" + title + "[/B][/COLOR]"
|
||||||
if item.contentType != "movie":
|
if item.contentType != "movie":
|
||||||
@@ -140,20 +140,20 @@ def scraper(item):
|
|||||||
title = title
|
title = title
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
Item(channel=item.channel, title=title, fulltitle=title, url=host + url, action=action, thumbnail=thumb,
|
Item(channel=item.channel, title=title, fulltitle=title, url=host + url, action=action, thumbnail=thumb,
|
||||||
fanart="http://imgur.com/nqmJozd.jpg", extra=title_fan + "|" + title_item + "|", show=title,
|
fanart="http://imgur.com/nqmJozd.jpg", extra=title_fan + "|" + title_item + "|" + year, show=title,
|
||||||
contentType=item.contentType, folder=True, language = idiomas))
|
contentType=item.contentType, folder=True, language = idiomas, infoLabels={"year":year}))
|
||||||
## Paginación
|
## Paginación
|
||||||
#tmdb.set_infoLabels(itemlist)
|
tmdb.set_infoLabels(itemlist)
|
||||||
#if year:
|
if year:
|
||||||
next = scrapertools.find_single_match(data, 'href="([^"]+)" title="Siguiente página">')
|
next = scrapertools.find_single_match(data, 'href="([^"]+)" title="Siguiente página">')
|
||||||
if len(next) > 0:
|
if len(next) > 0:
|
||||||
url = next
|
url = next
|
||||||
if not "http" in url:
|
if not "http" in url:
|
||||||
url = host + url
|
url = host + url
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
Item(channel=item.channel, action="scraper", title="[COLOR floralwhite][B]Siguiente[/B][/COLOR]",
|
Item(channel=item.channel, action="scraper", title="[COLOR floralwhite][B]Siguiente[/B][/COLOR]",
|
||||||
url=url, thumbnail="http://imgur.com/jhRFAmk.png", fanart="http://imgur.com/nqmJozd.jpg",
|
url=url, thumbnail="http://imgur.com/jhRFAmk.png", fanart="http://imgur.com/nqmJozd.jpg",
|
||||||
extra=item.extra, contentType=item.contentType, folder=True))
|
extra=item.extra, contentType=item.contentType, folder=True))
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Executable → Regular
+12
-116
@@ -10,6 +10,7 @@ from core import jsontools
|
|||||||
from core import scrapertools
|
from core import scrapertools
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
from core.tmdb import Tmdb
|
from core.tmdb import Tmdb
|
||||||
|
from core import trakt_tools
|
||||||
from platformcode import config, logger
|
from platformcode import config, logger
|
||||||
from platformcode import platformtools
|
from platformcode import platformtools
|
||||||
|
|
||||||
@@ -250,7 +251,7 @@ def filmaf(item):
|
|||||||
def trakt(item):
|
def trakt(item):
|
||||||
itemlist = []
|
itemlist = []
|
||||||
item.text_color = color1
|
item.text_color = color1
|
||||||
token_auth = config.get_setting("token_trakt", "tvmoviedb")
|
token_auth = config.get_setting("token_trakt", "trakt")
|
||||||
page = "?page=1&limit=20&extended=full"
|
page = "?page=1&limit=20&extended=full"
|
||||||
if not item.extra:
|
if not item.extra:
|
||||||
item.extra = "movie"
|
item.extra = "movie"
|
||||||
@@ -279,7 +280,7 @@ def trakt(item):
|
|||||||
item.extra = "movie"
|
item.extra = "movie"
|
||||||
# Se comprueba si existe un token guardado y sino se ejecuta el proceso de autentificación
|
# Se comprueba si existe un token guardado y sino se ejecuta el proceso de autentificación
|
||||||
if not token_auth:
|
if not token_auth:
|
||||||
folder = (config.get_platform() == "plex")
|
#folder = (config.get_platform() == "plex")
|
||||||
itemlist.append(item.clone(title="Vincula tu cuenta trakt", action="auth_trakt", folder=folder))
|
itemlist.append(item.clone(title="Vincula tu cuenta trakt", action="auth_trakt", folder=folder))
|
||||||
else:
|
else:
|
||||||
itemlist.append(item.clone(title="Watchlists", action="", text_color=color2))
|
itemlist.append(item.clone(title="Watchlists", action="", text_color=color2))
|
||||||
@@ -589,7 +590,7 @@ def detalles(item):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
token_auth = config.get_setting("token_trakt", "tvmoviedb")
|
token_auth = config.get_setting("token_trakt", "trakt")
|
||||||
if token_auth:
|
if token_auth:
|
||||||
itemlist.append(item.clone(title="Gestionar con tu cuenta Trakt", action="menu_trakt"))
|
itemlist.append(item.clone(title="Gestionar con tu cuenta Trakt", action="menu_trakt"))
|
||||||
|
|
||||||
@@ -1550,7 +1551,7 @@ def detalles_fa(item):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
token_auth = config.get_setting("token_trakt", "tvmoviedb")
|
token_auth = config.get_setting("token_trakt", "trakt")
|
||||||
if token_auth and ob_tmdb.result:
|
if token_auth and ob_tmdb.result:
|
||||||
itemlist.append(item.clone(title="[Trakt] Gestionar con tu cuenta", action="menu_trakt"))
|
itemlist.append(item.clone(title="[Trakt] Gestionar con tu cuenta", action="menu_trakt"))
|
||||||
# Acciones si se configura cuenta en FA (Votar y añadir/quitar en listas)
|
# Acciones si se configura cuenta en FA (Votar y añadir/quitar en listas)
|
||||||
@@ -2065,118 +2066,13 @@ def fanartv(item):
|
|||||||
|
|
||||||
##-------------------- SECCION TRAKT.TV ------------------------##
|
##-------------------- SECCION TRAKT.TV ------------------------##
|
||||||
def auth_trakt(item):
|
def auth_trakt(item):
|
||||||
# Autentificación de cuenta Trakt, proceso parecido a real-debrid
|
return trakt_tools.auth_trakt()
|
||||||
client_id = "a83c1a92d1313bd7ac7baa37a3fc83add26833d4b006f9f9562cae213a761260"
|
|
||||||
headers = {'Content-Type': 'application/json', 'trakt-api-key': client_id, 'trakt-api-version': '2'}
|
|
||||||
try:
|
|
||||||
post = {'client_id': client_id}
|
|
||||||
post = jsontools.dump(post)
|
|
||||||
# Se solicita url y código de verificación para conceder permiso a la app
|
|
||||||
url = "http://api-v2launch.trakt.tv/oauth/device/code"
|
|
||||||
data = httptools.downloadpage(url, post=post, headers=headers, replace_headers=True).data
|
|
||||||
data = jsontools.load(data)
|
|
||||||
item.verify_url = data["verification_url"]
|
|
||||||
item.user_code = data["user_code"]
|
|
||||||
item.device_code = data["device_code"]
|
|
||||||
item.intervalo = data["interval"]
|
|
||||||
if not item.folder:
|
|
||||||
token_trakt(item)
|
|
||||||
else:
|
|
||||||
itemlist = []
|
|
||||||
title = "Accede a esta página: %s" % item.verify_url
|
|
||||||
itemlist.append(item.clone(title=title, action=""))
|
|
||||||
title = "Ingresa este código y acepta: %s" % item.user_code
|
|
||||||
itemlist.append(item.clone(title=title, action=""))
|
|
||||||
title = "Una vez hecho, pulsa aquí!"
|
|
||||||
itemlist.append(item.clone(title=title, action="token_trakt"))
|
|
||||||
return itemlist
|
|
||||||
except:
|
|
||||||
import traceback
|
|
||||||
logger.error(traceback.format_exc())
|
|
||||||
|
|
||||||
|
|
||||||
def token_trakt(item):
|
|
||||||
client_id = "a83c1a92d1313bd7ac7baa37a3fc83add26833d4b006f9f9562cae213a761260"
|
|
||||||
client_secret = "cb22e3c36547ba375e5de077fa4aa497daf486e29b92a5b9c25bb17ac39b98bf"
|
|
||||||
headers = {'Content-Type': 'application/json', 'trakt-api-key': client_id, 'trakt-api-version': '2'}
|
|
||||||
try:
|
|
||||||
if item.extra == "renew":
|
|
||||||
refresh = config.get_setting("refresh_token_trakt", "tvmoviedb")
|
|
||||||
url = "http://api-v2launch.trakt.tv/oauth/device/token"
|
|
||||||
post = {'refresh_token': refresh, 'client_id': client_id, 'client_secret': client_secret,
|
|
||||||
'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob', 'grant_type': 'refresh_token'}
|
|
||||||
post = jsontools.dump(post)
|
|
||||||
data = httptools.downloadpage(url, post, headers, replace_headers=True).data
|
|
||||||
data = jsontools.load(data)
|
|
||||||
elif item.action == "token_trakt":
|
|
||||||
url = "http://api-v2launch.trakt.tv/oauth/device/token"
|
|
||||||
post = {'code': item.device_code, 'client_id': client_id, 'client_secret': client_secret}
|
|
||||||
post = jsontools.dump(post)
|
|
||||||
post = "code=%s&client_id=%s&client_secret=%s" % (item.device_code, client_id, client_secret)
|
|
||||||
data = httptools.downloadpage(url, post, headers, replace_headers=True).data
|
|
||||||
data = jsontools.load(data)
|
|
||||||
else:
|
|
||||||
import time
|
|
||||||
dialog_auth = platformtools.dialog_progress("Autentificación. No cierres esta ventana!!",
|
|
||||||
"1. Entra en la siguiente url: %s" % item.verify_url,
|
|
||||||
"2. Ingresa este código en la página y acepta: %s" % item.user_code,
|
|
||||||
"3. Espera a que se cierre esta ventana")
|
|
||||||
|
|
||||||
# Generalmente cada 5 segundos se intenta comprobar si el usuario ha introducido el código
|
|
||||||
while True:
|
|
||||||
time.sleep(item.intervalo)
|
|
||||||
try:
|
|
||||||
if dialog_auth.iscanceled():
|
|
||||||
return
|
|
||||||
|
|
||||||
url = "http://api-v2launch.trakt.tv/oauth/device/token"
|
|
||||||
post = {'code': item.device_code, 'client_id': client_id, 'client_secret': client_secret}
|
|
||||||
post = jsontools.dump(post)
|
|
||||||
data = httptools.downloadpage(url, post, headers, replace_headers=True).data
|
|
||||||
data = jsontools.load(data)
|
|
||||||
if "access_token" in data:
|
|
||||||
# Código introducido, salimos del bucle
|
|
||||||
break
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
dialog_auth.close()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
token = data["access_token"]
|
|
||||||
refresh = data["refresh_token"]
|
|
||||||
|
|
||||||
config.set_setting("token_trakt", token, "tvmoviedb")
|
|
||||||
config.set_setting("refresh_token_trakt", refresh, "tvmoviedb")
|
|
||||||
if not item.folder:
|
|
||||||
platformtools.dialog_notification("Éxito", "Cuenta vinculada correctamente")
|
|
||||||
if config.is_xbmc():
|
|
||||||
import xbmc
|
|
||||||
xbmc.executebuiltin("Container.Refresh")
|
|
||||||
return
|
|
||||||
|
|
||||||
except:
|
|
||||||
import traceback
|
|
||||||
logger.error(traceback.format_exc())
|
|
||||||
if not item.folder:
|
|
||||||
return platformtools.dialog_notification("Error", "Fallo en el proceso de vinculación")
|
|
||||||
token = ""
|
|
||||||
|
|
||||||
itemlist = []
|
|
||||||
if token:
|
|
||||||
itemlist.append(item.clone("Cuenta vinculada con éxito", action=""))
|
|
||||||
else:
|
|
||||||
itemlist.append(item.clone("Fallo en el proceso de vinculación", action=""))
|
|
||||||
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
|
|
||||||
def menu_trakt(item):
|
def menu_trakt(item):
|
||||||
# Menú con acciones de cuenta trakt (vistas, watchlist, coleccion)
|
# Menú con acciones de cuenta trakt (vistas, watchlist, coleccion)
|
||||||
itemlist = []
|
itemlist = []
|
||||||
token_auth = config.get_setting("token_trakt", "tvmoviedb")
|
token_auth = config.get_setting("token_trakt", "trakt")
|
||||||
tipo = item.extra.replace("tv", "show") + "s"
|
tipo = item.extra.replace("tv", "show") + "s"
|
||||||
title = item.contentType.replace("movie", "película").replace("tvshow", "serie")
|
title = item.contentType.replace("movie", "película").replace("tvshow", "serie")
|
||||||
try:
|
try:
|
||||||
@@ -2219,13 +2115,13 @@ def menu_trakt(item):
|
|||||||
|
|
||||||
|
|
||||||
def acciones_trakt(item):
|
def acciones_trakt(item):
|
||||||
token_auth = config.get_setting("token_trakt", "tvmoviedb")
|
token_auth = config.get_setting("token_trakt", "trakt")
|
||||||
itemlist = []
|
itemlist = []
|
||||||
item.text_color = color1
|
item.text_color = color1
|
||||||
|
|
||||||
item.contentType = item.extra.replace("show", "tvshow")
|
item.contentType = item.extra.replace("show", "tvshow")
|
||||||
|
|
||||||
client_id = "a83c1a92d1313bd7ac7baa37a3fc83add26833d4b006f9f9562cae213a761260"
|
client_id = "c40ba210716aee87f6a9ddcafafc56246909e5377b623b72c15909024448e89d"
|
||||||
headers = [['Content-Type', 'application/json'], ['trakt-api-key', client_id],
|
headers = [['Content-Type', 'application/json'], ['trakt-api-key', client_id],
|
||||||
['trakt-api-version', '2']]
|
['trakt-api-version', '2']]
|
||||||
if token_auth:
|
if token_auth:
|
||||||
@@ -2238,8 +2134,8 @@ def acciones_trakt(item):
|
|||||||
url = "http://api-v2launch.trakt.tv/%s" % item.url
|
url = "http://api-v2launch.trakt.tv/%s" % item.url
|
||||||
data = httptools.downloadpage(url, post, headers=headers, replace_headers=True)
|
data = httptools.downloadpage(url, post, headers=headers, replace_headers=True)
|
||||||
if data.code == "401":
|
if data.code == "401":
|
||||||
token_trakt(item.clone(extra="renew"))
|
trakt_tools.token_trakt(item.clone(extra="renew"))
|
||||||
token_auth = config.get_setting("token_trakt", "tvmoviedb")
|
token_auth = config.get_setting("token_trakt", "trakt")
|
||||||
headers[3][1] = "Bearer %s" % token_auth
|
headers[3][1] = "Bearer %s" % token_auth
|
||||||
data = httptools.downloadpage(url, post, headers=headers, replace_headers=True)
|
data = httptools.downloadpage(url, post, headers=headers, replace_headers=True)
|
||||||
|
|
||||||
@@ -2612,7 +2508,7 @@ def detalles_mal(item):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
token_auth = config.get_setting("token_trakt", "tvmoviedb")
|
token_auth = config.get_setting("token_trakt", "trakt")
|
||||||
if token_auth and ob_tmdb.result:
|
if token_auth and ob_tmdb.result:
|
||||||
itemlist.append(item.clone(title="[Trakt] Gestionar con tu cuenta", action="menu_trakt"))
|
itemlist.append(item.clone(title="[Trakt] Gestionar con tu cuenta", action="menu_trakt"))
|
||||||
|
|
||||||
|
|||||||
@@ -423,11 +423,11 @@ def set_infoLabels_item(item, seekTmdb=True, idioma_busqueda='es', lock=None):
|
|||||||
|
|
||||||
otmdb = Tmdb(texto_buscado=titulo_buscado, tipo=tipo_busqueda, idioma_busqueda=idioma_busqueda,
|
otmdb = Tmdb(texto_buscado=titulo_buscado, tipo=tipo_busqueda, idioma_busqueda=idioma_busqueda,
|
||||||
filtro=item.infoLabels.get('filtro', {}), year=item.infoLabels['year'])
|
filtro=item.infoLabels.get('filtro', {}), year=item.infoLabels['year'])
|
||||||
|
if otmdb is not None:
|
||||||
if otmdb.get_id() and config.get_setting("tmdb_plus_info", default=False):
|
if otmdb.get_id() and config.get_setting("tmdb_plus_info", default=False):
|
||||||
# Si la busqueda ha dado resultado y no se esta buscando una lista de items,
|
# Si la busqueda ha dado resultado y no se esta buscando una lista de items,
|
||||||
# realizar otra busqueda para ampliar la informacion
|
# realizar otra busqueda para ampliar la informacion
|
||||||
otmdb = Tmdb(id_Tmdb=otmdb.result.get("id"), tipo=tipo_busqueda, idioma_busqueda=idioma_busqueda)
|
otmdb = Tmdb(id_Tmdb=otmdb.result.get("id"), tipo=tipo_busqueda, idioma_busqueda=idioma_busqueda)
|
||||||
|
|
||||||
if lock and lock.locked():
|
if lock and lock.locked():
|
||||||
lock.release()
|
lock.release()
|
||||||
|
|||||||
@@ -0,0 +1,269 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# -*- Tools for trakt sync -*-
|
||||||
|
# -*- Created for Alfa-addon -*-
|
||||||
|
# -*- By the Alfa Develop Group -*
|
||||||
|
|
||||||
|
import os
|
||||||
|
import xbmc
|
||||||
|
from core import httptools
|
||||||
|
from core.item import Item
|
||||||
|
from platformcode.platformtools import logger, config
|
||||||
|
from core import jsontools
|
||||||
|
|
||||||
|
client_id = "c40ba210716aee87f6a9ddcafafc56246909e5377b623b72c15909024448e89d"
|
||||||
|
client_secret = "999164f25832341f0214453bb11c915adb18e9490d6b5e9a707963a5a1bee43e"
|
||||||
|
|
||||||
|
def auth_trakt():
|
||||||
|
item = Item()
|
||||||
|
folder = (config.get_platform() == "plex")
|
||||||
|
item.folder=folder
|
||||||
|
# Autentificación de cuenta Trakt
|
||||||
|
headers = {'Content-Type': 'application/json', 'trakt-api-key': client_id, 'trakt-api-version': '2'}
|
||||||
|
try:
|
||||||
|
post = {'client_id': client_id}
|
||||||
|
post = jsontools.dump(post)
|
||||||
|
# Se solicita url y código de verificación para conceder permiso a la app
|
||||||
|
url = "http://api-v2launch.trakt.tv/oauth/device/code"
|
||||||
|
data = httptools.downloadpage(url, post=post, headers=headers, replace_headers=True).data
|
||||||
|
data = jsontools.load(data)
|
||||||
|
item.verify_url = data["verification_url"]
|
||||||
|
item.user_code = data["user_code"]
|
||||||
|
item.device_code = data["device_code"]
|
||||||
|
item.intervalo = data["interval"]
|
||||||
|
if not item.folder:
|
||||||
|
token_trakt(item)
|
||||||
|
|
||||||
|
else:
|
||||||
|
itemlist = []
|
||||||
|
title = "Accede a esta página: %s" % item.verify_url
|
||||||
|
itemlist.append(item.clone(title=title, action=""))
|
||||||
|
title = "Ingresa este código y acepta: %s" % item.user_code
|
||||||
|
itemlist.append(item.clone(title=title, action=""))
|
||||||
|
title = "Una vez hecho, pulsa aquí!"
|
||||||
|
itemlist.append(item.clone(title=title, action="token_trakt"))
|
||||||
|
return itemlist
|
||||||
|
except:
|
||||||
|
import traceback
|
||||||
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
def token_trakt(item):
|
||||||
|
|
||||||
|
from platformcode import platformtools
|
||||||
|
|
||||||
|
headers = {'Content-Type': 'application/json', 'trakt-api-key': client_id, 'trakt-api-version': '2'}
|
||||||
|
try:
|
||||||
|
if item.extra == "renew":
|
||||||
|
refresh = config.get_setting("refresh_token_trakt", "trakt")
|
||||||
|
url = "http://api-v2launch.trakt.tv/oauth/device/token"
|
||||||
|
post = {'refresh_token': refresh, 'client_id': client_id, 'client_secret': client_secret,
|
||||||
|
'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob', 'grant_type': 'refresh_token'}
|
||||||
|
post = jsontools.dump(post)
|
||||||
|
data = httptools.downloadpage(url, post, headers, replace_headers=True).data
|
||||||
|
data = jsontools.load(data)
|
||||||
|
elif item.action == "token_trakt":
|
||||||
|
url = "http://api-v2launch.trakt.tv/oauth/device/token"
|
||||||
|
post = {'code': item.device_code, 'client_id': client_id, 'client_secret': client_secret}
|
||||||
|
post = jsontools.dump(post)
|
||||||
|
post = "code=%s&client_id=%s&client_secret=%s" % (item.device_code, client_id, client_secret)
|
||||||
|
data = httptools.downloadpage(url, post, headers, replace_headers=True).data
|
||||||
|
data = jsontools.load(data)
|
||||||
|
else:
|
||||||
|
import time
|
||||||
|
dialog_auth = platformtools.dialog_progress("Sincronizar con Trakt. No cierres esta ventana",
|
||||||
|
"1. Entra en la siguiente url: %s" % item.verify_url,
|
||||||
|
"2. Ingresa este código en la página y acepta: %s" % item.user_code,
|
||||||
|
"3. Espera a que se cierre esta ventana")
|
||||||
|
|
||||||
|
# Generalmente cada 5 segundos se intenta comprobar si el usuario ha introducido el código
|
||||||
|
while True:
|
||||||
|
time.sleep(item.intervalo)
|
||||||
|
try:
|
||||||
|
if dialog_auth.iscanceled():
|
||||||
|
config.set_setting("trakt_sync", 'false' )
|
||||||
|
return
|
||||||
|
|
||||||
|
url = "http://api-v2launch.trakt.tv/oauth/device/token"
|
||||||
|
post = {'code': item.device_code, 'client_id': client_id, 'client_secret': client_secret}
|
||||||
|
post = jsontools.dump(post)
|
||||||
|
data = httptools.downloadpage(url, post, headers, replace_headers=True).data
|
||||||
|
data = jsontools.load(data)
|
||||||
|
if "access_token" in data:
|
||||||
|
# Código introducido, salimos del bucle
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
dialog_auth.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
token = data["access_token"]
|
||||||
|
refresh = data["refresh_token"]
|
||||||
|
|
||||||
|
config.set_setting("token_trakt", token, "trakt")
|
||||||
|
config.set_setting("refresh_token_trakt", refresh, "trakt")
|
||||||
|
if not item.folder:
|
||||||
|
platformtools.dialog_notification("Éxito", "Cuenta vinculada correctamente")
|
||||||
|
if config.is_xbmc():
|
||||||
|
import xbmc
|
||||||
|
xbmc.executebuiltin("Container.Refresh")
|
||||||
|
return
|
||||||
|
|
||||||
|
except:
|
||||||
|
import traceback
|
||||||
|
logger.error(traceback.format_exc())
|
||||||
|
if not item.folder:
|
||||||
|
return platformtools.dialog_notification("Error", "Fallo en el proceso de vinculación")
|
||||||
|
token = ""
|
||||||
|
|
||||||
|
itemlist = []
|
||||||
|
if token:
|
||||||
|
itemlist.append(item.clone("Cuenta vinculada con éxito", action=""))
|
||||||
|
else:
|
||||||
|
itemlist.append(item.clone("Fallo en el proceso de vinculación", action=""))
|
||||||
|
|
||||||
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
|
def get_trakt_watched(id_type, mediatype, update=False):
|
||||||
|
|
||||||
|
logger.info()
|
||||||
|
|
||||||
|
id_list = []
|
||||||
|
id_dict = dict()
|
||||||
|
|
||||||
|
token_auth = config.get_setting("token_trakt", "trakt")
|
||||||
|
|
||||||
|
if token_auth:
|
||||||
|
sync_path = os.path.join(config.get_data_path(), 'settings_channels', 'trakt')
|
||||||
|
|
||||||
|
if os.path.exists(sync_path) and not update:
|
||||||
|
trakt_node = jsontools.get_node_from_file('trakt', "TRAKT")
|
||||||
|
if mediatype == 'shows':
|
||||||
|
return trakt_node['shows']
|
||||||
|
if mediatype == 'movies':
|
||||||
|
return trakt_node['movies']
|
||||||
|
|
||||||
|
else:
|
||||||
|
token_auth = config.get_setting("token_trakt", "trakt")
|
||||||
|
if token_auth:
|
||||||
|
try:
|
||||||
|
token_auth = config.get_setting("token_trakt", "trakt")
|
||||||
|
headers = [['Content-Type', 'application/json'], ['trakt-api-key', client_id], ['trakt-api-version', '2']]
|
||||||
|
if token_auth:
|
||||||
|
headers.append(['Authorization', "Bearer %s" % token_auth])
|
||||||
|
url = "https://api.trakt.tv/sync/watched/%s" % mediatype
|
||||||
|
data = httptools.downloadpage(url, headers=headers, replace_headers=True).data
|
||||||
|
watched_dict = jsontools.load(data)
|
||||||
|
|
||||||
|
if mediatype == 'shows':
|
||||||
|
|
||||||
|
dict_show = dict()
|
||||||
|
for item in watched_dict:
|
||||||
|
temp =[]
|
||||||
|
id = str(item['show']['ids']['tmdb'])
|
||||||
|
season_dict=dict()
|
||||||
|
for season in item['seasons']:
|
||||||
|
ep=[]
|
||||||
|
number = str(season['number'])
|
||||||
|
#season_dict = dict()
|
||||||
|
for episode in season['episodes']:
|
||||||
|
ep.append(str(episode['number']))
|
||||||
|
season_dict[number]=ep
|
||||||
|
temp.append(season_dict)
|
||||||
|
dict_show[id] = season_dict
|
||||||
|
id_dict=dict_show
|
||||||
|
return id_dict
|
||||||
|
|
||||||
|
elif mediatype == 'movies':
|
||||||
|
for item in watched_dict:
|
||||||
|
id_list.append(str(item['movie']['ids'][id_type]))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return id_list
|
||||||
|
|
||||||
|
|
||||||
|
def trakt_check(itemlist):
|
||||||
|
id_result = ''
|
||||||
|
#check = u'\u221a'
|
||||||
|
check = 'v'
|
||||||
|
get_sync_from_file()
|
||||||
|
try:
|
||||||
|
for item in itemlist:
|
||||||
|
info = item.infoLabels
|
||||||
|
|
||||||
|
if info != '' and info['mediatype'] in ['movie', 'episode'] and item.channel !='videolibrary':
|
||||||
|
|
||||||
|
mediatype = 'movies'
|
||||||
|
id_type = 'tmdb'
|
||||||
|
|
||||||
|
if info['mediatype'] == 'episode':
|
||||||
|
mediatype = 'shows'
|
||||||
|
|
||||||
|
if id_result == '':
|
||||||
|
id_result = get_trakt_watched(id_type, mediatype)
|
||||||
|
if info['mediatype'] == 'movie':
|
||||||
|
if info[id_type+'_id'] in id_result:
|
||||||
|
item.title ='[COLOR limegreen][%s][/COLOR] %s' % (check, item.title)
|
||||||
|
|
||||||
|
elif info['mediatype']=='episode':
|
||||||
|
if info[id_type+'_id'] in id_result:
|
||||||
|
id= info[id_type+'_id']
|
||||||
|
if info['season'] != '' and info['episode'] != '':
|
||||||
|
season = str(info['season'])
|
||||||
|
|
||||||
|
if season in id_result[id]:
|
||||||
|
episode = str(info['episode'])
|
||||||
|
|
||||||
|
if episode in id_result[id][season]:
|
||||||
|
season_watched = id_result[id][season]
|
||||||
|
|
||||||
|
if episode in season_watched:
|
||||||
|
item.title = '[B][COLOR limegreen][[I]%s[/I]][/COLOR][/B] %s' % (check,
|
||||||
|
item.title)
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return itemlist
|
||||||
|
|
||||||
|
def get_sync_from_file():
|
||||||
|
logger.info()
|
||||||
|
sync_path = os.path.join(config.get_data_path(),'settings_channels' ,'trakt')
|
||||||
|
trakt_node = {}
|
||||||
|
if os.path.exists(sync_path):
|
||||||
|
trakt_node = jsontools.get_node_from_file('trakt', "TRAKT")
|
||||||
|
|
||||||
|
trakt_node['movies']=get_trakt_watched('tmdb', 'movies')
|
||||||
|
trakt_node['shows']=get_trakt_watched('tmdb', 'shows')
|
||||||
|
jsontools.update_node(trakt_node, 'trakt', 'TRAKT')
|
||||||
|
|
||||||
|
def update_trakt_data(mediatype, trakt_data):
|
||||||
|
logger.info()
|
||||||
|
|
||||||
|
sync_path = os.path.join(config.get_data_path(), 'settings_channels', 'trakt')
|
||||||
|
trakt_node = {}
|
||||||
|
if os.path.exists(sync_path):
|
||||||
|
trakt_node = jsontools.get_node_from_file('trakt', "TRAKT")
|
||||||
|
trakt_node[mediatype] = trakt_data
|
||||||
|
jsontools.update_node(trakt_node, 'trakt', 'TRAKT')
|
||||||
|
|
||||||
|
def ask_install_script():
|
||||||
|
logger.info()
|
||||||
|
import xbmc
|
||||||
|
from platformcode import platformtools
|
||||||
|
|
||||||
|
respuesta = platformtools.dialog_yesno("Alfa", "Puedes instalar el script de Trakt a continuacíon, "
|
||||||
|
"una vez instalado y configurado lo que "
|
||||||
|
"veas se sincronizara con tu cuenta automaticamente.",
|
||||||
|
"¿Deseas continuar?")
|
||||||
|
if respuesta:
|
||||||
|
xbmc.executebuiltin("InstallAddon(script.trakt)")
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
config.set_setting('install_trakt','false')
|
||||||
|
return
|
||||||
@@ -11,6 +11,7 @@ from core import channeltools
|
|||||||
from core import scrapertools
|
from core import scrapertools
|
||||||
from core import servertools
|
from core import servertools
|
||||||
from core import videolibrarytools
|
from core import videolibrarytools
|
||||||
|
from core import trakt_tools
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
from platformcode import config, logger
|
from platformcode import config, logger
|
||||||
from platformcode import platformtools
|
from platformcode import platformtools
|
||||||
@@ -149,6 +150,7 @@ def run(item=None):
|
|||||||
# Entry point for a channel is the "mainlist" action, so here we check parental control
|
# Entry point for a channel is the "mainlist" action, so here we check parental control
|
||||||
if item.action == "mainlist":
|
if item.action == "mainlist":
|
||||||
|
|
||||||
|
|
||||||
# Parental control
|
# Parental control
|
||||||
# If it is an adult channel, and user has configured pin, asks for it
|
# If it is an adult channel, and user has configured pin, asks for it
|
||||||
if channeltools.is_adult(item.channel) and config.get_setting("adult_request_password"):
|
if channeltools.is_adult(item.channel) and config.get_setting("adult_request_password"):
|
||||||
@@ -280,6 +282,19 @@ def run(item=None):
|
|||||||
# menu = Item(channel="channelselector", action="getmainlist", viewmode="movie", thumbnail=menu_icon,
|
# menu = Item(channel="channelselector", action="getmainlist", viewmode="movie", thumbnail=menu_icon,
|
||||||
# title='Menu')
|
# title='Menu')
|
||||||
# itemlist.insert(0, menu)
|
# itemlist.insert(0, menu)
|
||||||
|
if config.get_setting('trakt_sync'):
|
||||||
|
token_auth = config.get_setting("token_trakt", "trakt")
|
||||||
|
if not token_auth:
|
||||||
|
trakt_tools.auth_trakt()
|
||||||
|
else:
|
||||||
|
import xbmc
|
||||||
|
if not xbmc.getCondVisibility('System.HasAddon(script.trakt)') and config.get_setting(
|
||||||
|
'install_trakt'):
|
||||||
|
trakt_tools.ask_install_script()
|
||||||
|
itemlist = trakt_tools.trakt_check(itemlist)
|
||||||
|
else:
|
||||||
|
config.set_setting('install_trakt', 'true')
|
||||||
|
|
||||||
platformtools.render_items(itemlist, item)
|
platformtools.render_items(itemlist, item)
|
||||||
|
|
||||||
except urllib2.URLError, e:
|
except urllib2.URLError, e:
|
||||||
|
|||||||
@@ -17,10 +17,30 @@ import xbmc
|
|||||||
import xbmcgui
|
import xbmcgui
|
||||||
import xbmcplugin
|
import xbmcplugin
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
|
from core import scrapertools
|
||||||
|
from core import httptools
|
||||||
|
from core import jsontools
|
||||||
from platformcode import logger
|
from platformcode import logger
|
||||||
from channelselector import get_thumb
|
from channelselector import get_thumb
|
||||||
|
from core import trakt_tools
|
||||||
|
|
||||||
|
|
||||||
|
class XBMCPlayer( xbmc.Player ):
|
||||||
|
|
||||||
|
def __init__( self, *args ):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onPlaybackEnded(self):
|
||||||
|
logger.info()
|
||||||
|
from time import sleep
|
||||||
|
sleep(20)
|
||||||
|
for mediatype in ['movies', 'shows']:
|
||||||
|
trakt_data = trakt_tools.get_trakt_watched('tmdb', mediatype, True)
|
||||||
|
trakt_tools.update_trakt_data(mediatype, trakt_data)
|
||||||
|
|
||||||
|
|
||||||
|
xbmc_player = XBMCPlayer()
|
||||||
|
|
||||||
def dialog_ok(heading, line1, line2="", line3=""):
|
def dialog_ok(heading, line1, line2="", line3=""):
|
||||||
dialog = xbmcgui.Dialog()
|
dialog = xbmcgui.Dialog()
|
||||||
return dialog.ok(heading, line1, line2, line3)
|
return dialog.ok(heading, line1, line2, line3)
|
||||||
@@ -156,6 +176,7 @@ def render_items(itemlist, parent_item):
|
|||||||
listitem.setThumbnailImage(item.thumbnail)
|
listitem.setThumbnailImage(item.thumbnail)
|
||||||
listitem.setProperty('fanart_image', fanart)
|
listitem.setProperty('fanart_image', fanart)
|
||||||
|
|
||||||
|
|
||||||
# No need it, use fanart instead
|
# No need it, use fanart instead
|
||||||
# xbmcplugin.setPluginFanart(int(sys.argv[1]), os.path.join(config.get_runtime_path(), "fanart.jpg"))
|
# xbmcplugin.setPluginFanart(int(sys.argv[1]), os.path.join(config.get_runtime_path(), "fanart.jpg"))
|
||||||
|
|
||||||
@@ -500,7 +521,7 @@ def set_context_commands(item, parent_item):
|
|||||||
|
|
||||||
|
|
||||||
def is_playing():
|
def is_playing():
|
||||||
return xbmc.Player().isPlaying()
|
return xbmc_player.isPlaying()
|
||||||
|
|
||||||
|
|
||||||
def play_video(item, strm=False, force_direct=False, autoplay=False):
|
def play_video(item, strm=False, force_direct=False, autoplay=False):
|
||||||
@@ -516,7 +537,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
|||||||
xlistitem.setThumbnailImage(item.thumbnail)
|
xlistitem.setThumbnailImage(item.thumbnail)
|
||||||
|
|
||||||
set_infolabels(xlistitem, item, True)
|
set_infolabels(xlistitem, item, True)
|
||||||
xbmc.Player().play(item.url, xlistitem)
|
xbmc_player.play(item.url, xlistitem)
|
||||||
return
|
return
|
||||||
|
|
||||||
default_action = config.get_setting("default_action")
|
default_action = config.get_setting("default_action")
|
||||||
@@ -573,14 +594,17 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
|||||||
playlist.add(mediaurl, xlistitem)
|
playlist.add(mediaurl, xlistitem)
|
||||||
|
|
||||||
# Reproduce
|
# Reproduce
|
||||||
xbmc_player = xbmc.Player()
|
xbmc_player = XBMCPlayer()
|
||||||
xbmc_player.play(playlist, xlistitem)
|
xbmc_player.play(playlist, xlistitem)
|
||||||
else:
|
else:
|
||||||
set_player(item, xlistitem, mediaurl, view, strm)
|
set_player(item, xlistitem, mediaurl, view, strm)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def stop_video():
|
def stop_video():
|
||||||
xbmc.Player().stop()
|
from time import sleep
|
||||||
|
xbmc_player.stop()
|
||||||
|
|
||||||
|
|
||||||
def get_seleccion(default_action, opciones, seleccion, video_urls):
|
def get_seleccion(default_action, opciones, seleccion, video_urls):
|
||||||
@@ -731,7 +755,6 @@ def get_dialogo_opciones(item, default_action, strm, autoplay):
|
|||||||
|
|
||||||
# Si no puedes ver el vídeo te informa
|
# Si no puedes ver el vídeo te informa
|
||||||
else:
|
else:
|
||||||
logger.debug('no puedes verlo :P')
|
|
||||||
if not autoplay:
|
if not autoplay:
|
||||||
if item.server != "":
|
if item.server != "":
|
||||||
if "<br/>" in motivo:
|
if "<br/>" in motivo:
|
||||||
@@ -870,7 +893,7 @@ def set_player(item, xlistitem, mediaurl, view, strm):
|
|||||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xlistitem)
|
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xlistitem)
|
||||||
if item.subtitle != "":
|
if item.subtitle != "":
|
||||||
xbmc.sleep(2000)
|
xbmc.sleep(2000)
|
||||||
xbmc.Player().setSubtitles(item.subtitle)
|
xbmc_player.setSubtitles(item.subtitle)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.info("player_mode=%s" % config.get_setting("player_mode"))
|
logger.info("player_mode=%s" % config.get_setting("player_mode"))
|
||||||
@@ -888,8 +911,11 @@ def set_player(item, xlistitem, mediaurl, view, strm):
|
|||||||
playlist.add(mediaurl, xlistitem)
|
playlist.add(mediaurl, xlistitem)
|
||||||
|
|
||||||
# Reproduce
|
# Reproduce
|
||||||
xbmc_player = xbmc.Player()
|
#xbmc_player = xbmc_player
|
||||||
xbmc_player.play(playlist, xlistitem)
|
xbmc_player.play(playlist, xlistitem)
|
||||||
|
while xbmc_player.isPlaying():
|
||||||
|
xbmc.sleep(200)
|
||||||
|
xbmc_player.onPlaybackEnded()
|
||||||
# elif config.get_setting("player_mode") == 1 or item.isPlayable:
|
# elif config.get_setting("player_mode") == 1 or item.isPlayable:
|
||||||
elif config.get_setting("player_mode") == 1:
|
elif config.get_setting("player_mode") == 1:
|
||||||
logger.info("mediaurl :" + mediaurl)
|
logger.info("mediaurl :" + mediaurl)
|
||||||
@@ -908,7 +934,7 @@ def set_player(item, xlistitem, mediaurl, view, strm):
|
|||||||
if item.subtitle != "" and view:
|
if item.subtitle != "" and view:
|
||||||
logger.info("Subtítulos externos: " + item.subtitle)
|
logger.info("Subtítulos externos: " + item.subtitle)
|
||||||
xbmc.sleep(2000)
|
xbmc.sleep(2000)
|
||||||
xbmc.Player().setSubtitles(item.subtitle)
|
xbmc_player.setSubtitles(item.subtitle)
|
||||||
|
|
||||||
# si es un archivo de la videoteca enviar a marcar como visto
|
# si es un archivo de la videoteca enviar a marcar como visto
|
||||||
if strm or item.strm_path:
|
if strm or item.strm_path:
|
||||||
@@ -977,7 +1003,7 @@ def play_torrent(item, xlistitem, mediaurl):
|
|||||||
client_tmp_path = config.get_data_path()
|
client_tmp_path = config.get_data_path()
|
||||||
|
|
||||||
# Iniciamos el cliente:
|
# Iniciamos el cliente:
|
||||||
c = Client(url=mediaurl, is_playing_fnc=xbmc.Player().isPlaying, wait_time=None, timeout=10,
|
c = Client(url=mediaurl, is_playing_fnc=xbmc_player.isPlaying, wait_time=None, timeout=10,
|
||||||
temp_path=os.path.join(client_tmp_path, "alfa-torrent"), print_status=debug)
|
temp_path=os.path.join(client_tmp_path, "alfa-torrent"), print_status=debug)
|
||||||
|
|
||||||
# Mostramos el progreso
|
# Mostramos el progreso
|
||||||
@@ -1041,7 +1067,7 @@ def play_torrent(item, xlistitem, mediaurl):
|
|||||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||||
playlist.clear()
|
playlist.clear()
|
||||||
playlist.add(videourl, xlistitem)
|
playlist.add(videourl, xlistitem)
|
||||||
xbmc_player = xbmc.Player()
|
#xbmc_player = xbmc_player
|
||||||
xbmc_player.play(playlist)
|
xbmc_player.play(playlist)
|
||||||
|
|
||||||
# Marcamos como reproducido para que no se vuelva a iniciar
|
# Marcamos como reproducido para que no se vuelva a iniciar
|
||||||
@@ -1053,7 +1079,7 @@ def play_torrent(item, xlistitem, mediaurl):
|
|||||||
xbmc_videolibrary.mark_auto_as_watched(item)
|
xbmc_videolibrary.mark_auto_as_watched(item)
|
||||||
|
|
||||||
# Y esperamos a que el reproductor se cierre
|
# Y esperamos a que el reproductor se cierre
|
||||||
while xbmc.Player().isPlaying():
|
while xbmc_player.isPlaying():
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
# Cuando este cerrado, Volvemos a mostrar el dialogo
|
# Cuando este cerrado, Volvemos a mostrar el dialogo
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<setting id="default_action" type="enum" lvalues="30006|30007|30008" label="30005" default="0"/>
|
<setting id="default_action" type="enum" lvalues="30006|30007|30008" label="30005" default="0"/>
|
||||||
<setting id="thumbnail_type" type="enum" lvalues="30011|30012|30200" label="30010" default="2"/>
|
<setting id="thumbnail_type" type="enum" lvalues="30011|30012|30200" label="30010" default="2"/>
|
||||||
<setting id="channel_language" type="labelenum" values="all|cast|lat" label="30019" default="all"/>
|
<setting id="channel_language" type="labelenum" values="all|cast|lat" label="30019" default="all"/>
|
||||||
|
<setting id="trakt_sync" type="bool" label="Sincronizar con Trakt.tv (Debes tener una cuenta)" default="false"/>
|
||||||
<setting id="forceview" type="bool" label="30043" default="false"/>
|
<setting id="forceview" type="bool" label="30043" default="false"/>
|
||||||
<setting id="debug" type="bool" label="30003" default="false"/>
|
<setting id="debug" type="bool" label="30003" default="false"/>
|
||||||
<setting label="Uso de servidores" type="lsep"/>
|
<setting label="Uso de servidores" type="lsep"/>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"ignore_urls": [],
|
"ignore_urls": [],
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"pattern": "userscloud.com/(?:embed-|)([A-z0-9]+)",
|
"pattern": "userscloud.com/(?:embed-|embed/|)([A-z0-9]+)",
|
||||||
"url": "http://userscloud.com/\\1"
|
"url": "http://userscloud.com/\\1"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -43,4 +43,4 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"thumbnail": "http://i.imgur.com/u4W2DgA.png?1"
|
"thumbnail": "http://i.imgur.com/u4W2DgA.png?1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,18 +19,18 @@ def test_video_exists(page_url):
|
|||||||
|
|
||||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||||
logger.info("url=" + page_url)
|
logger.info("url=" + page_url)
|
||||||
|
|
||||||
video_urls = []
|
video_urls = []
|
||||||
|
unpacked = ""
|
||||||
data = httptools.downloadpage(page_url).data
|
data = httptools.downloadpage(page_url).data
|
||||||
packed = scrapertools.find_single_match(data, "function\(p,a,c,k.*?</script>")
|
packed = scrapertools.find_single_match(data, "function\(p,a,c,k.*?</script>")
|
||||||
unpacked = jsunpack.unpack(packed)
|
if packed:
|
||||||
|
unpacked = jsunpack.unpack(packed)
|
||||||
media_url = scrapertools.find_single_match(unpacked, 'src"value="([^"]+)')
|
media_url = scrapertools.find_single_match(unpacked, 'src"value="([^"]+)')
|
||||||
if not media_url:
|
if not media_url:
|
||||||
id_ = page_url.rsplit("/", 1)[1]
|
id_ = page_url.rsplit("/", 1)[1]
|
||||||
rand = scrapertools.find_single_match(data, 'name="rand" value="([^"]+)"')
|
rand = scrapertools.find_single_match(data, 'name="rand" value="([^"]+)"')
|
||||||
post = "op=download2&id=%s&rand=%s&referer=%s&method_free=&method_premium=" % (id_, rand, page_url)
|
post = "op=download2&id=%s&rand=%s&referer=%s&method_free=&method_premium=" % (id_, rand, page_url)
|
||||||
data = httptools.downloadpage(page_url, post).data
|
data = httptools.downloadpage(page_url, post).data
|
||||||
|
|
||||||
media_url = scrapertools.find_single_match(data, '<div id="dl_link".*?<a href="([^"]+)"')
|
media_url = scrapertools.find_single_match(data, '<div id="dl_link".*?<a href="([^"]+)"')
|
||||||
|
|
||||||
ext = scrapertools.get_filename_from_url(media_url)[-4:]
|
ext = scrapertools.get_filename_from_url(media_url)[-4:]
|
||||||
|
|||||||
Reference in New Issue
Block a user