He tenido un par de pararadas con el xbmctorrent pero han sido con descargas muy lentas. Se pausaba sólo el vídeo, y a la cuarta o quinta se paraba. Me ha pasado con Hércule y Robin Hood de Clásicos Disney.
Lo que me he dado cuenta que no me va pulsar ??? Como todas las pruebas las he hecho desde xbmctorrent ni enterarme hasta que he querido probar las dos de Clásicos Disney.
Tendré que revisar la instación. No me va en ningún canal y con ningun enlace.
Sobre los zips, te pego el aquitorrent.py con lo que he hecho. Pruebalo completo. Y si te va bien arreglas el tuyo a tu gusto.
Código: Seleccionar todo
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
import sys
from core import scrapertools
from core import config
from core import logger
from core.item import Item
from servers import servertools
__channel__ = "aquitorrent"
__category__ = "F"
__type__ = "generic"
__title__ = "Aquitorrent"
__language__ = "ES"
host = "http://www.aquitorrent.com/"
DEBUG = config.get_setting("debug")
def isGeneric():
return True
def mainlist(item):
logger.info("pelisalacarta.aquitorrent mainlist")
itemlist = []
itemlist.append( Item(channel=__channel__, action="peliculas", title="Películas", url=host+"torr.asp?pagina=1&tipo=PELICULAS"))
itemlist.append( Item(channel=__channel__, action="peliculas", title="Series", url=host+"torr.asp?pagina=1&tipo=SERIES"))
itemlist.append( Item(channel=__channel__, action="peliculas", title="Películas HD", url=host+"torr.asp?pagina=1&tipo=Peliculas%20HD"))
itemlist.append( Item(channel=__channel__, action="peliculas", title="Películas 3D", url=host+"torr.asp?pagina=1&tipo=PELICULAS%203D"))
itemlist.append( Item(channel=__channel__, action="peliculas", title="DVDR Imagen de DVD", url=host+"torr.asp?pagina=1&tipo=DVDR%20IMAGEN%20DE%20DVD"))
itemlist.append( Item(channel=__channel__, action="peliculas", title="BR Imagen de BlueRay", url=host+"torr.asp?pagina=1&tipo=BR%20IMAGEN%20DE%20BLUERAY"))
itemlist.append( Item(channel=__channel__, action="peliculas", title="Películas V.O.S.", url=host+"torr.asp?pagina=1&tipo=PELICULAS%20V.O.S."))
itemlist.append( Item(channel=__channel__, action="peliculas", title="Docus y TV", url=host+"torr.asp?pagina=1&tipo=Docus%20y%20TV"))
itemlist.append( Item(channel=__channel__, action="peliculas", title="Clásicos Disney", url=host+"torr.asp?pagina=1&tipo=CLASICOS%20DISNEY"))
itemlist.append( Item(channel=__channel__, action="peliculas", title="F1 2014", url=host+"torr.asp?pagina=1&tipo=F1%202014"))
itemlist.append( Item(channel=__channel__, action="peliculas", title="MotoGP 2014", url=host+"torr.asp?pagina=1&tipo=MotoGP%202014"))
itemlist.append( Item(channel=__channel__, action="peliculas", title="Mundial 2014", url=host+"torr.asp?pagina=1&tipo=Mundial%202014"))
itemlist.append( Item(channel=__channel__, action="search", title="Buscar...", url=""))
return itemlist
# Al llamarse "search" la función, el launcher pide un texto a buscar y lo añade como parámetro
def search(item,texto):
logger.info("[pelisalacarta.aquitorrent search texto="+texto)
item.url = host+"buscar.asp?pagina=1&buscar=%s" % (texto)
try:
return peliculas(item)
# Se captura la excepción, para no interrumpir al buscador global si un canal falla
except:
import sys
for line in sys.exc_info():
logger.error( "%s" % line )
return []
def peliculas(item):
logger.info("pelisalacarta.aquitorrent peliculas")
itemlist = []
data = scrapertools.cache_page(item.url)
data = re.sub(r"\n|\r|\t|\s{2}| ","",data)
# Elimina el título en los href de los enlaces
data = re.sub(r'&/[^"]+">','">',data)
patron = '<div class="div_pic"[^>]+>'
patron+= '<a href="([^"]+)">'
patron+= '<img src="([^"]+)" alt="([^"]+)"'
matches = re.compile(patron,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
for scrapedurl, scrapedthumbnail, scrapedtitle in matches:
# Arregla la url y thumbnail
scrapedurl = fix_url(scrapedurl)
scrapedthumbnail = fix_url(scrapedthumbnail)
itemlist.append( Item(channel=__channel__, title =scrapedtitle , url=host+scrapedurl, action="findvideos", thumbnail=scrapedthumbnail) )
## Paginación
pagina = int(scrapertools.get_match(item.url,"pagina=(\d+)"))+1
pagina = "pagina=%s" % (pagina)
next_page = re.sub(r"pagina=\d+", pagina, item.url)
if pagina in data:
itemlist.append( Item(channel=__channel__, title=">> Página siguiente", url=next_page, action="peliculas", folder=True) )
return itemlist
def findvideos(item):
logger.info("pelisalacarta.aquitorrent findvideos")
itemlist = []
data = scrapertools.cache_page(item.url)
data = re.sub(r"\n|\r|\t|\s{2}| ","",data)
# Torrent en zip
patron = '<td class="wrapper_pic_td">.*? '
patron+= 'alt="([^"]+)".*? '
patron+= 'href="(.*?\.zip)".*?'
patron+= '"2"><br><br>(.*)<br><br><img'
matches = re.compile(patron,re.DOTALL).findall(data)
if len(matches)>0:
for scrapedtitle, scrapedzip, scrapedplot in matches:
plotformat = re.compile('(.*?:).*?<br />',re.DOTALL).findall(scrapedplot)
for plot in plotformat:
scrapedplot = scrapedplot.replace(plot,"[COLOR blue][B]"+plot+"[/B][/COLOR]")
scrapedplot = scrapedplot.replace("<br />","[CR]")
scrapedplot = unicode( scrapedplot, "iso-8859-1" , errors="replace" ).encode("utf-8")
# Arregla la url y extrae el torrent
scrapedtorrent = unzip(fix_url(scrapedzip))
itemlist.append( Item(channel=__channel__, title =item.title+" [torrent]" , url=scrapedtorrent, plot=scrapedplot, action="play", server="torrent", thumbnail=item.thumbnail, folder=False) )
# Normal
patron = '<td class="wrapper_pic_td">.*? '
patron+= 'alt="([^"]+)".*? '
patron+= 'href="(magnet[^"]+)".*?'
patron+= 'title="Visionado Online".*?'
patron+= '<a href="http://www.bitlet.org/video/play.torrent=([^&]+)&.*?'
patron+= '"2"><br><br>(.*)<br><br><img'
matches = re.compile(patron,re.DOTALL).findall(data)
if len(matches)>0:
for scrapedtitle, scrapedmagnet, scrapedtorrent, scrapedplot in matches:
plotformat = re.compile('(.*?:).*?<br />',re.DOTALL).findall(scrapedplot)
for plot in plotformat:
scrapedplot = scrapedplot.replace(plot,"[COLOR blue][B]"+plot+"[/B][/COLOR]")
scrapedplot = scrapedplot.replace("<br />","[CR]")
scrapedplot = unicode( scrapedplot, "iso-8859-1" , errors="replace" ).encode("utf-8")
itemlist.append( Item(channel=__channel__, title =item.title+" [magnet]" , url=scrapedmagnet, plot=scrapedplot, action="play", server="torrent", thumbnail=item.thumbnail, folder=False) )
itemlist.append( Item(channel=__channel__, title =item.title+" [torrent]" , url=scrapedtorrent, plot=scrapedplot, action="play", server="torrent", thumbnail=item.thumbnail, folder=False) )
return itemlist
def fix_url(url):
if url.startswith("/"):
url = url[1:]
if not url.startswith("http://"):
url = host+url
return url
def unzip(url):
import zipfile
# Path para guardar el zip como tem.zip los .torrent extraidos del zip
torrents_path = config.get_library_path()+'/torrents'
if not os.path.exists(torrents_path):
os.mkdir(torrents_path)
## http://stackoverflow.com/questions/4028697/how-do-i-download-a-zip-file-in-python-using-urllib2
# Open the url
try:
f = urllib2.urlopen(url)
with open( torrents_path+"/temp.zip", "wb") as local_file:
local_file.write(f.read())
# Open our local file for writing
fh = open(torrents_path+"/temp.zip", 'rb')
z = zipfile.ZipFile(fh)
for name in z.namelist():
z.extract(name, torrents_path)
fh.close()
#handle errors
except urllib2.HTTPError, e:
print "HTTP Error:", e.code, url
except urllib2.URLError, e:
print "URL Error:", e.reason, url
torrent = "file:///"+torrents_path+"/"+name
return torrent
Los archivos se guardan en la ruta que tengas configurada la librería en la carpeta torrents, si no existe la crea. Si no te gusta el nombre de la carpeta la cambias.