Merge pull request #553 from lopezvg/master
Torrents: soporte de .torrent en archivos .zip y/o con POST
This commit is contained in:
@@ -525,7 +525,7 @@ def findvideos(item):
|
|||||||
|
|
||||||
#Bajamos los datos de la página
|
#Bajamos los datos de la página
|
||||||
data = ''
|
data = ''
|
||||||
patron = '<a onclick="eventDownloadTorrent\(.*?\)".?class="linktorrent" href="([^"]+)">'
|
patron = '<a onclick="eventDownloadTorrent\(.*?\)".?class="linktorrent" href="([^"]+)"'
|
||||||
if item.contentType == 'movie': #Es una peli
|
if item.contentType == 'movie': #Es una peli
|
||||||
try:
|
try:
|
||||||
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url, timeout=timeout).data)
|
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url, timeout=timeout).data)
|
||||||
@@ -588,7 +588,7 @@ def findvideos(item):
|
|||||||
#Buscamos si ya tiene tamaño, si no, los buscamos en el archivo .torrent
|
#Buscamos si ya tiene tamaño, si no, los buscamos en el archivo .torrent
|
||||||
size = scrapertools.find_single_match(item_local.quality, '\s\[(\d+,?\d*?\s\w\s?[b|B])\]')
|
size = scrapertools.find_single_match(item_local.quality, '\s\[(\d+,?\d*?\s\w\s?[b|B])\]')
|
||||||
if not size and not item.armagedon:
|
if not size and not item.armagedon:
|
||||||
size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent
|
size = generictools.get_torrent_size(scrapedurl) #Buscamos el tamaño en el .torrent
|
||||||
if size:
|
if size:
|
||||||
item_local.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía
|
item_local.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía
|
||||||
item_local.title = '%s [%s]' % (item_local.title, size) #Agregamos size al final del título
|
item_local.title = '%s [%s]' % (item_local.title, size) #Agregamos size al final del título
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
"id": "domain_name",
|
"id": "domain_name",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "URL actual de la Web Mejor Torrent",
|
"label": "URL actual de la Web Mejor Torrent",
|
||||||
"default": "https://mejortorrent1.com/",
|
"default": "https://mejortorrent1.net/",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"visible": true
|
"visible": true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -809,10 +809,10 @@ def listado_busqueda(item):
|
|||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
logger.info()
|
logger.info()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
itemlist_t = [] #Itemlist total de enlaces
|
itemlist_t = [] #Itemlist total de enlaces
|
||||||
itemlist_f = [] #Itemlist de enlaces filtrados
|
itemlist_f = [] #Itemlist de enlaces filtrados
|
||||||
if not item.language:
|
if not item.language:
|
||||||
item.language = ['CAST'] #Castellano por defecto
|
item.language = ['CAST'] #Castellano por defecto
|
||||||
matches = []
|
matches = []
|
||||||
|
|
||||||
#logger.debug(item)
|
#logger.debug(item)
|
||||||
@@ -827,7 +827,7 @@ def findvideos(item):
|
|||||||
#Si es un lookup para cargar las urls de emergencia en la Videoteca...
|
#Si es un lookup para cargar las urls de emergencia en la Videoteca...
|
||||||
if item.videolibray_emergency_urls:
|
if item.videolibray_emergency_urls:
|
||||||
item.emergency_urls = []
|
item.emergency_urls = []
|
||||||
item.emergency_urls.append([]) #Reservamos el espacio para los .torrents locales
|
item.emergency_urls.append([]) #Reservamos el espacio para los .torrents locales
|
||||||
|
|
||||||
#Bajamos los datos de la página de todo menos de Documentales y Varios
|
#Bajamos los datos de la página de todo menos de Documentales y Varios
|
||||||
if not item.post:
|
if not item.post:
|
||||||
@@ -836,7 +836,7 @@ def findvideos(item):
|
|||||||
data = data.replace('"', "'")
|
data = data.replace('"', "'")
|
||||||
patron = "<form (?:.*?)?"
|
patron = "<form (?:.*?)?"
|
||||||
patron += "name='episodios'.+action='([^']+)' method='post'>.*?"
|
patron += "name='episodios'.+action='([^']+)' method='post'>.*?"
|
||||||
patron += "<input.+type='[^']+'.+name='([^']+)'.+value='([^']+)'>.*<input.+type='hidden'.+value='([^']+)'.+name='([^']+)'>"
|
patron += "<input\s*type='[^']+'\s*name='([^']+)'\s*value='([^']+)'>\s*<input\s*type='[^']+'\s*value='([^']+)'\s*name='([^']+)'>(?:\s*<input\s*type='[^']+'\s*value='([^']+)'\s*name='([^']+)'\s*id='([^']+)'>)?"
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if not data:
|
if not data:
|
||||||
@@ -846,10 +846,10 @@ def findvideos(item):
|
|||||||
matches = item.emergency_urls[1] #Restauramos matches
|
matches = item.emergency_urls[1] #Restauramos matches
|
||||||
item.armagedon = True #Marcamos la situación como catastrófica
|
item.armagedon = True #Marcamos la situación como catastrófica
|
||||||
else:
|
else:
|
||||||
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||||
return item #Devolvemos el Item de la llamada
|
return item #Devolvemos el Item de la llamada
|
||||||
else:
|
else:
|
||||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||||
|
|
||||||
if not item.armagedon: #Si es un proceso normal, seguimos
|
if not item.armagedon: #Si es un proceso normal, seguimos
|
||||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||||
@@ -878,55 +878,72 @@ def findvideos(item):
|
|||||||
if item.videolibray_emergency_urls:
|
if item.videolibray_emergency_urls:
|
||||||
item.emergency_urls.append(matches) #Salvamnos matches...
|
item.emergency_urls.append(matches) #Salvamnos matches...
|
||||||
|
|
||||||
for scrapedurl, name1, value1, value2, name2 in matches: #Hacemos el FOR aunque solo habrá un item
|
for scrapedurl, name1, value1, value2, name2, value3, name3, id3 in matches: #Hacemos el FOR aunque solo habrá un item
|
||||||
#Generamos una copia de Item para trabajar sobre ella
|
|
||||||
item_local = item.clone()
|
|
||||||
url = scrapedurl
|
url = scrapedurl
|
||||||
|
|
||||||
# Localiza el .torrent en el siguiente link con Post
|
# Localiza el .torrent en el siguiente link con Post
|
||||||
post = '%s=%s&%s=%s' % (name1, value1, name2, value2)
|
post = '%s=%s&%s=%s' % (name1, value1, name2, value2)
|
||||||
|
#post = '%s=%s&%s=%s&%s=%s' % (name1, value1, name2, value2, name3, value3)
|
||||||
if not item.armagedon:
|
if not item.armagedon:
|
||||||
try:
|
try:
|
||||||
torrent_data = httptools.downloadpage(url, post=post, headers=headers, follow_redirects=False)
|
torrent_data = httptools.downloadpage(url, post=post, headers=headers, follow_redirects=False)
|
||||||
except: #error
|
except: #error
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
#Viene de SERIES y DOCUMENTALES. Generamos una copia de Item para trabajar sobre ella
|
#Viene de SERIES y DOCUMENTALES. Generamos una copia de Item para trabajar sobre ella
|
||||||
item_local = item.clone()
|
|
||||||
try: #Localiza el .torrent en el siguiente link con Post. Viene de Documentales y Varios
|
try: #Localiza el .torrent en el siguiente link con Post. Viene de Documentales y Varios
|
||||||
url = item.url_post
|
url = item.url_post
|
||||||
torrent_data = httptools.downloadpage(url, post=item.post, headers=headers, follow_redirects=False)
|
del item.url_post
|
||||||
|
post = item.post
|
||||||
|
torrent_data = httptools.downloadpage(url, post=post, headers=headers, follow_redirects=False)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not torrent_data or not 'location' in torrent_data.headers or not torrent_data.headers['location']:
|
if not torrent_data and not ('location' in torrent_data.headers or 'zip' in torrent_data.headers['content-type']):
|
||||||
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
|
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
|
||||||
if item.intervencion: #Sí ha sido clausurada judicialmente
|
if item.intervencion: #Sí ha sido clausurada judicialmente
|
||||||
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error
|
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error
|
||||||
elif not item.armagedon:
|
elif not item.armagedon:
|
||||||
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / URL: " + url + " / DATA: " + data)
|
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / URL: " + url + " / POST: " + post + " / DATA: " + str(torrent_data.headers))
|
||||||
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
|
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log'))
|
||||||
|
|
||||||
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia?
|
||||||
item_local.url = item.emergency_urls[0][0] #Restauramos la url del .torrent
|
item.url = item.emergency_urls[0][0] #Restauramos la url del .torrent
|
||||||
item.armagedon = True #Marcamos la situación como catastrófica
|
item.armagedon = True #Marcamos la situación como catastrófica
|
||||||
else:
|
else:
|
||||||
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
|
||||||
return item #Devolvemos el Item de la llamada
|
return item #Devolvemos el Item de la llamada
|
||||||
else:
|
else:
|
||||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||||
|
|
||||||
|
#Si el torrent viene en un .zip en vez de desde una url, lo preparamos todo para el play
|
||||||
|
referer_zip = None
|
||||||
|
post_zip = None
|
||||||
|
if 'location' not in torrent_data.headers and 'zip' in torrent_data.headers['content-type'] and not item.armagedon:
|
||||||
|
item.referer = item.url
|
||||||
|
referer_zip = item.referer
|
||||||
|
item.url = url
|
||||||
|
item.post = post
|
||||||
|
post_zip = item.post
|
||||||
|
|
||||||
|
#Generamos una copia de Item para trabajar sobre ella
|
||||||
|
item_local = item.clone()
|
||||||
|
|
||||||
#Capturamos la url del .torrent desde el Header
|
#Capturamos la url del .torrent desde el Header
|
||||||
if not item.armagedon:
|
if not item.armagedon:
|
||||||
item_local.url = torrent_data.headers['location'] if 'location' in torrent_data.headers else item.url_post
|
item_local.url = torrent_data.headers['location'] if 'location' in torrent_data.headers else item.url
|
||||||
item_local.url = item_local.url.replace(" ", "%20") #Quitamos espacios
|
item_local.url = item_local.url.replace(" ", "%20") #Quitamos espacios
|
||||||
if item.emergency_urls:
|
if item.emergency_urls:
|
||||||
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA
|
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA
|
||||||
|
|
||||||
#Si es un lookup para cargar las urls de emergencia en la Videoteca...
|
#Si es un lookup para cargar las urls de emergencia en la Videoteca...
|
||||||
if item.videolibray_emergency_urls:
|
if item.videolibray_emergency_urls:
|
||||||
item.emergency_urls[0].append(item_local.url) #Salvamnos la url...
|
if 'location' in torrent_data.headers or config.get_setting("emergency_urls_torrents", item_local.channel):
|
||||||
|
item.emergency_urls[0].append(item_local.url) #Salvamnos la url...
|
||||||
|
elif not config.get_setting("emergency_urls_torrents", item_local.channel):
|
||||||
|
item.emergency_urls[0].append(item_local.referer) #Salvamnos el referer...
|
||||||
return item #... y nos vamos
|
return item #... y nos vamos
|
||||||
|
|
||||||
# Poner la calidad, si es necesario
|
# Poner la calidad, si es necesario
|
||||||
@@ -947,7 +964,7 @@ def findvideos(item):
|
|||||||
size = scrapertools.find_single_match(item_local.url, '(\d{1,3},\d{1,2}?\w+)\.torrent')
|
size = scrapertools.find_single_match(item_local.url, '(\d{1,3},\d{1,2}?\w+)\.torrent')
|
||||||
size = size.upper().replace(".", ",").replace("G", " G ").replace("M", " M ") #sustituimos . por , porque Unify lo borra
|
size = size.upper().replace(".", ",").replace("G", " G ").replace("M", " M ") #sustituimos . por , porque Unify lo borra
|
||||||
if not size and not item.armagedon:
|
if not size and not item.armagedon:
|
||||||
size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent
|
size = generictools.get_torrent_size(item_local.url, referer_zip, post_zip) #Buscamos el tamaño en el .torrent
|
||||||
if size:
|
if size:
|
||||||
item_local.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía
|
item_local.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía
|
||||||
item_local.title = '%s [%s]' % (item_local.title, size) #Agregamos size al final del título
|
item_local.title = '%s [%s]' % (item_local.title, size) #Agregamos size al final del título
|
||||||
@@ -1021,7 +1038,7 @@ def episodios(item):
|
|||||||
# Prepara el patrón de búsqueda
|
# Prepara el patrón de búsqueda
|
||||||
patron = "<form (?:style='[^']+'\s)?name='episodios' action='([^']+)'"
|
patron = "<form (?:style='[^']+'\s)?name='episodios' action='([^']+)'"
|
||||||
url = scrapertools.find_single_match(data, patron) #Salvamos la url de descarga
|
url = scrapertools.find_single_match(data, patron) #Salvamos la url de descarga
|
||||||
url = url.replace('descargar_series.php', 'descargar.php') #ESTA DESCARGARÍA EL TORRENT EN VEZ DEL ENLACE
|
url = url.replace('descargar_tv.php', 'descargar_post.php') #ESTA DESCARGARÍA EL TORRENT EN VEZ DEL ENLACE
|
||||||
patron = "<form (?:style='[^']+'\s)?name='episodios' action='[^']+'.*?<input type='hidden' value='([^']+)' name='([^']+)'>"
|
patron = "<form (?:style='[^']+'\s)?name='episodios' action='[^']+'.*?<input type='hidden' value='([^']+)' name='([^']+)'>"
|
||||||
value2 = '' #Patrón general para Documentales (1)
|
value2 = '' #Patrón general para Documentales (1)
|
||||||
name2 = ''
|
name2 = ''
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
"id": "clonenewpct1_channels_list",
|
"id": "clonenewpct1_channels_list",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "Lista de clones de NewPct1 y orden de uso",
|
"label": "Lista de clones de NewPct1 y orden de uso",
|
||||||
"default": "('1', 'descargas2020', 'http://descargas2020.com/', 'movie, tvshow, season, episode', ''), ('1', 'tumejortorrent', 'http://tumejortorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentrapid', 'http://torrentrapid.com/', 'movie, tvshow, season, episode', 'serie_episodios'), ('1', 'pctnew', 'http://pctnew.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentlocura', 'http://torrentlocura.com/', 'movie, tvshow, season, episode', ''), ('1', 'tvsinpagar', 'http://www.tvsinpagar.com/', 'tvshow, season, episode', ''), ('1', 'planetatorrent', 'http://planetatorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'mispelisyseries', 'http://mispelisyseries.com/', 'movie', 'search, listado_busqueda')",
|
"default": "('1', 'descargas2020', 'https://descargas2020.com/', 'movie, tvshow, season, episode', ''), ('1', 'tumejortorrent', 'https://tumejortorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentrapid', 'https://torrentrapid.com/', 'movie, tvshow, season, episode', 'serie_episodios'), ('1', 'pctnew', 'https://pctnew.com/', 'movie, tvshow, season, episode', ''), ('1', 'torrentlocura', 'http://torrentlocura.com/', 'movie, tvshow, season, episode', ''), ('1', 'tvsinpagar', 'http://www.tvsinpagar.com/', 'tvshow, season, episode', ''), ('1', 'planetatorrent', 'http://planetatorrent.com/', 'movie, tvshow, season, episode', ''), ('1', 'mispelisyseries', 'http://mispelisyseries.com/', 'movie', 'search, listado_busqueda')",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"visible": false
|
"visible": false
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ def submenu(item):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
patron = '<li><a\s?class="[^"]+"\s?href="http:[^"]+"><i\s?class=.*><\/i>.*Inicio<\/a><\/li>(.+)<\/ul>\s?<\/nav>'
|
patron = '<li><a\s*class="[^"]+"\s*href="http.*:[^"]+"><i\s*class=.*><\/i>.*Inicio<\/a><\/li>(.+)<\/ul>\s*<\/nav>'
|
||||||
#Verificamos si se ha cargado una página, y si además tiene la estructura correcta
|
#Verificamos si se ha cargado una página, y si además tiene la estructura correcta
|
||||||
if not data or not scrapertools.find_single_match(data, patron):
|
if not data or not scrapertools.find_single_match(data, patron):
|
||||||
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
|
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
|
||||||
@@ -1434,9 +1434,9 @@ def findvideos(item):
|
|||||||
data = data.replace("$!", "#!").replace("'", "\"").replace("ñ", "ñ").replace("//pictures", "/pictures")
|
data = data.replace("$!", "#!").replace("'", "\"").replace("ñ", "ñ").replace("//pictures", "/pictures")
|
||||||
url_servidores = item.url
|
url_servidores = item.url
|
||||||
category_servidores = item.category
|
category_servidores = item.category
|
||||||
data_servidores = data #salvamos data para verificar servidores, si es necesario
|
data_servidores = data #salvamos data para verificar servidores, si es necesario
|
||||||
data_servidores_stat = False
|
data_servidores_stat = False
|
||||||
except: #La web no responde. Probemos las urls de emergencia
|
except: #La web no responde. Probemos las urls de emergencia
|
||||||
pass
|
pass
|
||||||
|
|
||||||
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent
|
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent
|
||||||
@@ -1445,8 +1445,11 @@ def findvideos(item):
|
|||||||
patron_alt = '<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' #Patron para .torrent (planetatorrent)
|
patron_alt = '<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' #Patron para .torrent (planetatorrent)
|
||||||
if scrapertools.find_single_match(data, patron):
|
if scrapertools.find_single_match(data, patron):
|
||||||
patron = patron_alt
|
patron = patron_alt
|
||||||
|
url_torr = scrapertools.find_single_match(data, patron)
|
||||||
|
if not url_torr.startswith("http"): #Si le falta el http.: lo ponemos
|
||||||
|
url_torr = scrapertools.find_single_match(host, '(\w+:)//') + url_torr
|
||||||
#Verificamos si se ha cargado una página, y si además tiene la estructura correcta
|
#Verificamos si se ha cargado una página, y si además tiene la estructura correcta
|
||||||
if not data or not scrapertools.find_single_match(data, patron) or not videolibrarytools.verify_url_torrent(scrapertools.find_single_match(data, patron)): # Si no hay datos o url, error
|
if not data or not scrapertools.find_single_match(data, patron) or not videolibrarytools.verify_url_torrent(url_torr): # Si no hay datos o url, error
|
||||||
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
|
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
|
||||||
if item.intervencion: #Sí ha sido clausurada judicialmente
|
if item.intervencion: #Sí ha sido clausurada judicialmente
|
||||||
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error
|
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error
|
||||||
@@ -1466,7 +1469,7 @@ def findvideos(item):
|
|||||||
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el vídeo
|
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el vídeo
|
||||||
item, data = generictools.fail_over_newpct1(item, patron_mult)
|
item, data = generictools.fail_over_newpct1(item, patron_mult)
|
||||||
|
|
||||||
if not data: #Si no ha logrado encontrar nada, verificamos si hay servidores
|
if not data: #Si no ha logrado encontrar nada, verificamos si hay servidores
|
||||||
cnt_servidores = 0
|
cnt_servidores = 0
|
||||||
item.category = category_servidores #restauramos valores originales
|
item.category = category_servidores #restauramos valores originales
|
||||||
item.url = url_servidores
|
item.url = url_servidores
|
||||||
@@ -1478,8 +1481,8 @@ def findvideos(item):
|
|||||||
enlaces_ver = re.compile(patron, re.DOTALL).findall(data_servidores)
|
enlaces_ver = re.compile(patron, re.DOTALL).findall(data_servidores)
|
||||||
enlaces_descargar = enlaces_ver
|
enlaces_descargar = enlaces_ver
|
||||||
|
|
||||||
for logo, servidor, idioma, calidad, enlace, title in enlaces_ver: #buscamos enlaces de servidores de ver-online
|
for logo, servidor, idioma, calidad, enlace, title in enlaces_ver: #buscamos enlaces de servidores de ver-online
|
||||||
if ver_enlaces_veronline == 0: #Si no se quiere Ver Online, se sale del bloque
|
if ver_enlaces_veronline == 0: #Si no se quiere Ver Online, se sale del bloque
|
||||||
break
|
break
|
||||||
if "ver" in title.lower():
|
if "ver" in title.lower():
|
||||||
cnt_servidores += 1
|
cnt_servidores += 1
|
||||||
@@ -1488,13 +1491,13 @@ def findvideos(item):
|
|||||||
item, data_servidores = generictools.fail_over_newpct1(item, patron) #intentamos recuperar servidores
|
item, data_servidores = generictools.fail_over_newpct1(item, patron) #intentamos recuperar servidores
|
||||||
|
|
||||||
#Miramos si ha servidores
|
#Miramos si ha servidores
|
||||||
if not data_servidores: #Si no ha logrado encontrar nada nos vamos
|
if not data_servidores: #Si no ha logrado encontrar nada nos vamos
|
||||||
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo'))
|
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo'))
|
||||||
itemlist.append(item.clone(action='', title=item.category + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
itemlist.append(item.clone(action='', title=item.category + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log'))
|
||||||
if item.videolibray_emergency_urls:
|
if item.videolibray_emergency_urls:
|
||||||
return item
|
return item
|
||||||
else:
|
else:
|
||||||
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
|
||||||
|
|
||||||
data = data_servidores #restauramos los datos
|
data = data_servidores #restauramos los datos
|
||||||
data_servidores_stat = True #Marcamos como que los hemos usado
|
data_servidores_stat = True #Marcamos como que los hemos usado
|
||||||
@@ -1514,8 +1517,8 @@ def findvideos(item):
|
|||||||
size = size.replace(".", ",") #sustituimos . por , porque Unify lo borra
|
size = size.replace(".", ",") #sustituimos . por , porque Unify lo borra
|
||||||
if not size:
|
if not size:
|
||||||
size = scrapertools.find_single_match(item.quality, '\s?\[(\d+.?\d*?\s?\w\s?[b|B])\]')
|
size = scrapertools.find_single_match(item.quality, '\s?\[(\d+.?\d*?\s?\w\s?[b|B])\]')
|
||||||
if not size and not item.armagedon:
|
if not size and not item.armagedon and not item.videolibray_emergency_urls:
|
||||||
size = generictools.get_torrent_size(scrapertools.find_single_match(data, patron)) #Buscamos el tamaño en el .torrent
|
size = generictools.get_torrent_size(url_torr) #Buscamos el tamaño en el .torrent
|
||||||
if size:
|
if size:
|
||||||
item.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
|
item.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
|
||||||
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
|
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
|
||||||
@@ -1531,13 +1534,13 @@ def findvideos(item):
|
|||||||
|
|
||||||
# Verificamos la url torrent o usamos la de emergencia
|
# Verificamos la url torrent o usamos la de emergencia
|
||||||
if not item.armagedon:
|
if not item.armagedon:
|
||||||
item_local.url = scrapertools.find_single_match(data, patron)
|
item_local.url = url_torr
|
||||||
if item_local.url == 'javascript:;':
|
if item_local.url == 'javascript:;':
|
||||||
item_local.url = '' #evitamos url vacías
|
item_local.url = '' #evitamos url vacías
|
||||||
item_local.url = item_local.url.replace(" ", "%20") #sustituimos espacios por %20, por si acaso
|
item_local.url = item_local.url.replace(" ", "%20") #sustituimos espacios por %20, por si acaso
|
||||||
|
|
||||||
if item_local.url and item.emergency_urls: #la url no está verificada
|
if item_local.url and item.emergency_urls: #la url no está verificada
|
||||||
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA
|
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA
|
||||||
|
|
||||||
if not item_local.url: #error en url?
|
if not item_local.url: #error en url?
|
||||||
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
|
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
|
||||||
@@ -2102,7 +2105,7 @@ def episodios(item):
|
|||||||
if season > max_temp:
|
if season > max_temp:
|
||||||
max_temp = season
|
max_temp = season
|
||||||
|
|
||||||
if match['quality'] and not item_local.quality and estado == True:
|
if match['quality'] and estado == True:
|
||||||
item_local.quality = match['quality'] #Si hay quality se coge, si no, la de la serie
|
item_local.quality = match['quality'] #Si hay quality se coge, si no, la de la serie
|
||||||
item_local.quality = item_local.quality.replace("ALTA DEFINICION", "HDTV")
|
item_local.quality = item_local.quality.replace("ALTA DEFINICION", "HDTV")
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ list_language = IDIOMAS.values()
|
|||||||
list_quality = []
|
list_quality = []
|
||||||
list_servers = ['torrent']
|
list_servers = ['torrent']
|
||||||
|
|
||||||
host = 'http://www.todo-peliculas.com/'
|
host = 'http://www.todo-peliculas.net/'
|
||||||
channel = "todopeliculas"
|
channel = "todopeliculas"
|
||||||
|
|
||||||
categoria = channel.capitalize()
|
categoria = channel.capitalize()
|
||||||
|
|||||||
@@ -428,20 +428,21 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True):
|
|||||||
else: #y si no...
|
else: #y si no...
|
||||||
e = emergency_urls(e, channel, json_path) #... las generamos
|
e = emergency_urls(e, channel, json_path) #... las generamos
|
||||||
else:
|
else:
|
||||||
e = emergency_urls(e, channel, json_path) #Si el episodio no existe, generamos las urls
|
e = emergency_urls(e, channel, json_path) #Si el episodio no existe, generamos las urls
|
||||||
if e.emergency_urls: #Si ya tenemos urls...
|
if e.emergency_urls: #Si ya tenemos urls...
|
||||||
emergency_urls_succ = True #... es un éxito y vamos a marcar el .nfo
|
emergency_urls_succ = True #... es un éxito y vamos a marcar el .nfo
|
||||||
elif emergency_urls_stat == 2 and e.contentType == 'episode': #Borramos urls de emergencia?
|
elif emergency_urls_stat == 2 and e.contentType == 'episode': #Borramos urls de emergencia?
|
||||||
if e.emergency_urls: del e.emergency_urls
|
if e.emergency_urls: del e.emergency_urls
|
||||||
emergency_urls_succ = True #... es un éxito y vamos a marcar el .nfo
|
emergency_urls_succ = True #... es un éxito y vamos a marcar el .nfo
|
||||||
elif emergency_urls_stat == 3 and e.contentType == 'episode': #Actualizamos urls de emergencia?
|
elif emergency_urls_stat == 3 and e.contentType == 'episode': #Actualizamos urls de emergencia?
|
||||||
if not silent:
|
if not silent:
|
||||||
p_dialog.update(0, 'Cacheando enlaces y archivos .torrent...', e.title) #progress dialog
|
p_dialog.update(0, 'Cacheando enlaces y archivos .torrent...', e.title) #progress dialog
|
||||||
e = emergency_urls(e, channel, json_path) #generamos las urls
|
e = emergency_urls(e, channel, json_path) #generamos las urls
|
||||||
if e.emergency_urls: #Si ya tenemos urls...
|
if e.emergency_urls: #Si ya tenemos urls...
|
||||||
emergency_urls_succ = True #... es un éxito y vamos a marcar el .nfo
|
emergency_urls_succ = True #... es un éxito y vamos a marcar el .nfo
|
||||||
|
|
||||||
e.infoLabels = serie.infoLabels
|
if not e.infoLabels: #en series multicanal, prevalece el infolabels...
|
||||||
|
e.infoLabels = serie.infoLabels #... del canal actual y no el del original
|
||||||
e.contentSeason, e.contentEpisodeNumber = season_episode.split("x")
|
e.contentSeason, e.contentEpisodeNumber = season_episode.split("x")
|
||||||
new_episodelist.append(e)
|
new_episodelist.append(e)
|
||||||
except:
|
except:
|
||||||
@@ -503,6 +504,8 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True):
|
|||||||
|
|
||||||
item_nfo = e.clone(channel="videolibrary", url="", action='findvideos',
|
item_nfo = e.clone(channel="videolibrary", url="", action='findvideos',
|
||||||
strm_path=strm_path.replace(TVSHOWS_PATH, ""))
|
strm_path=strm_path.replace(TVSHOWS_PATH, ""))
|
||||||
|
if item_nfo.emergency_urls:
|
||||||
|
del item_nfo.emergency_urls #Solo se mantiene en el .json del episodio
|
||||||
|
|
||||||
nfo_exists = filetools.write(nfo_path, head_nfo + item_nfo.tojson())
|
nfo_exists = filetools.write(nfo_path, head_nfo + item_nfo.tojson())
|
||||||
|
|
||||||
@@ -513,7 +516,8 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True):
|
|||||||
if not item_nfo:
|
if not item_nfo:
|
||||||
head_nfo, item_nfo = read_nfo(nfo_path)
|
head_nfo, item_nfo = read_nfo(nfo_path)
|
||||||
|
|
||||||
e.infoLabels = item_nfo.infoLabels
|
if not e.infoLabels: #en series multicanal, prevalece el infolabels...
|
||||||
|
e.infoLabels = item_nfo.infoLabels #... del canal actual y no el del original
|
||||||
|
|
||||||
if filetools.write(json_path, e.tojson()):
|
if filetools.write(json_path, e.tojson()):
|
||||||
if not json_exists:
|
if not json_exists:
|
||||||
@@ -754,6 +758,8 @@ def emergency_urls(item, channel=None, path=None):
|
|||||||
#Si el usuario ha activado la opción "emergency_urls_torrents", se descargarán los archivos .torrent de cada título
|
#Si el usuario ha activado la opción "emergency_urls_torrents", se descargarán los archivos .torrent de cada título
|
||||||
else: #Si se han cacheado con éxito los enlaces...
|
else: #Si se han cacheado con éxito los enlaces...
|
||||||
try:
|
try:
|
||||||
|
referer = None
|
||||||
|
post = None
|
||||||
channel_bis = generictools.verify_channel(item.channel)
|
channel_bis = generictools.verify_channel(item.channel)
|
||||||
if config.get_setting("emergency_urls_torrents", channel_bis) and item_res.emergency_urls and path != None:
|
if config.get_setting("emergency_urls_torrents", channel_bis) and item_res.emergency_urls and path != None:
|
||||||
videolibrary_path = config.get_videolibrary_path() #detectamos el path absoluto del título
|
videolibrary_path = config.get_videolibrary_path() #detectamos el path absoluto del título
|
||||||
@@ -765,12 +771,26 @@ def emergency_urls(item, channel=None, path=None):
|
|||||||
folder = series
|
folder = series
|
||||||
videolibrary_path = filetools.join(videolibrary_path, folder)
|
videolibrary_path = filetools.join(videolibrary_path, folder)
|
||||||
i = 1
|
i = 1
|
||||||
|
if item_res.referer: referer = item_res.referer
|
||||||
|
if item_res.post: post = item_res.post
|
||||||
for url in item_res.emergency_urls[0]: #Recorremos las urls de emergencia...
|
for url in item_res.emergency_urls[0]: #Recorremos las urls de emergencia...
|
||||||
torrents_path = re.sub(r'(?:\.\w+$)', '_%s.torrent' % str(i).zfill(2), path)
|
torrents_path = re.sub(r'(?:\.\w+$)', '_%s.torrent' % str(i).zfill(2), path)
|
||||||
path_real = caching_torrents(url, torrents_path=torrents_path) #... para descargar los .torrents
|
path_real = caching_torrents(url, referer, post, torrents_path=torrents_path) #... para descargar los .torrents
|
||||||
if path_real: #Si ha tenido éxito...
|
if path_real: #Si ha tenido éxito...
|
||||||
item_res.emergency_urls[0][i-1] = path_real.replace(videolibrary_path, '') #se guarda el "path" relativo
|
item_res.emergency_urls[0][i-1] = path_real.replace(videolibrary_path, '') #se guarda el "path" relativo
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
#Restauramos variables originales
|
||||||
|
if item.referer:
|
||||||
|
item_res.referer = item.referer
|
||||||
|
elif item_res.referer:
|
||||||
|
del item_res.referer
|
||||||
|
if item.referer:
|
||||||
|
item_res.referer = item.referer
|
||||||
|
elif item_res.referer:
|
||||||
|
del item_res.referer
|
||||||
|
item_res.url = item.url
|
||||||
|
|
||||||
except:
|
except:
|
||||||
logger.error('ERROR al cachear el .torrent de: ' + item.channel + ' / ' + item.title)
|
logger.error('ERROR al cachear el .torrent de: ' + item.channel + ' / ' + item.title)
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
@@ -780,23 +800,26 @@ def emergency_urls(item, channel=None, path=None):
|
|||||||
return item_res #Devolvemos el Item actualizado con los enlaces de emergencia
|
return item_res #Devolvemos el Item actualizado con los enlaces de emergencia
|
||||||
|
|
||||||
|
|
||||||
def caching_torrents(url, torrents_path=None, timeout=10, lookup=False, data_torrent=False):
|
def caching_torrents(url, referer=None, post=None, torrents_path=None, timeout=10, lookup=False, data_torrent=False):
|
||||||
if torrents_path != None:
|
if torrents_path != None:
|
||||||
logger.info("path = " + torrents_path)
|
logger.info("path = " + torrents_path)
|
||||||
else:
|
else:
|
||||||
logger.info()
|
logger.info()
|
||||||
|
if referer and post:
|
||||||
|
logger.info('REFERER: ' + referer)
|
||||||
import urllib
|
import urllib
|
||||||
import re
|
import re
|
||||||
from core import httptools
|
from core import httptools
|
||||||
torrent_file = ''
|
torrent_file = ''
|
||||||
|
headers = {'Content-Type': 'application/x-www-form-urlencoded', 'Referer': referer} #Necesario para el Post del .Torrent
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Descarga en el path recibido el .torrent de la url recibida, y pasa el decode
|
Descarga en el path recibido el .torrent de la url recibida, y pasa el decode
|
||||||
Devuelve el path real del .torrent, o el path vacío si la operación no ha tenido éxito
|
Devuelve el path real del .torrent, o el path vacío si la operación no ha tenido éxito
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
videolibrary_path = config.get_videolibrary_path() #Calculamos el path absoluto a partir de la Videoteca
|
||||||
if torrents_path == None:
|
if torrents_path == None:
|
||||||
videolibrary_path = config.get_videolibrary_path() #Calculamos el path absoluto a partir de la Videoteca
|
|
||||||
if not videolibrary_path:
|
if not videolibrary_path:
|
||||||
torrents_path = ''
|
torrents_path = ''
|
||||||
if data_torrent:
|
if data_torrent:
|
||||||
@@ -815,7 +838,11 @@ def caching_torrents(url, torrents_path=None, timeout=10, lookup=False, data_tor
|
|||||||
return torrents_path #Si hay un error, devolvemos el "path" vacío
|
return torrents_path #Si hay un error, devolvemos el "path" vacío
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = httptools.downloadpage(url, timeout=timeout) #Descargamos el .torrent
|
#Descargamos el .torrent
|
||||||
|
if referer and post: #Descarga con POST
|
||||||
|
response = httptools.downloadpage(url, headers=headers, post=post, follow_redirects=False, timeout=timeout)
|
||||||
|
else: #Descarga sin post
|
||||||
|
response = httptools.downloadpage(url, timeout=timeout)
|
||||||
if not response.sucess:
|
if not response.sucess:
|
||||||
logger.error('Archivo .torrent no encontrado: ' + url)
|
logger.error('Archivo .torrent no encontrado: ' + url)
|
||||||
torrents_path = ''
|
torrents_path = ''
|
||||||
@@ -834,15 +861,50 @@ def caching_torrents(url, torrents_path=None, timeout=10, lookup=False, data_tor
|
|||||||
return torrents_path #Si hay un error, devolvemos el "path" vacío
|
return torrents_path #Si hay un error, devolvemos el "path" vacío
|
||||||
torrent_file = response.data
|
torrent_file = response.data
|
||||||
|
|
||||||
if not scrapertools.find_single_match(torrent_file, '^d\d+:.*?\d+:'): #No es un archivo .torrent (RAR, ZIP, HTML,..., vacío)
|
#Si es un archivo .ZIP tratamos de extraer el contenido
|
||||||
|
if torrent_file.startswith("PK"):
|
||||||
|
logger.info('Es un archivo .ZIP: ' + url)
|
||||||
|
|
||||||
|
torrents_path_zip = filetools.join(videolibrary_path, 'temp_torrents_zip') #Carpeta de trabajo
|
||||||
|
torrents_path_zip = filetools.encode(torrents_path_zip)
|
||||||
|
torrents_path_zip_file = filetools.join(torrents_path_zip, 'temp_torrents_zip.zip') #Nombre del .zip
|
||||||
|
|
||||||
|
import time
|
||||||
|
filetools.rmdirtree(torrents_path_zip) #Borramos la carpeta temporal
|
||||||
|
time.sleep(1) #Hay que esperar, porque si no da error
|
||||||
|
filetools.mkdir(torrents_path_zip) #La creamos de nuevo
|
||||||
|
|
||||||
|
if filetools.write(torrents_path_zip_file, torrent_file): #Salvamos el .zip
|
||||||
|
torrent_file = '' #Borramos el contenido en memoria
|
||||||
|
try: #Extraemos el .zip
|
||||||
|
from core import ziptools
|
||||||
|
unzipper = ziptools.ziptools()
|
||||||
|
unzipper.extract(torrents_path_zip_file, torrents_path_zip)
|
||||||
|
except:
|
||||||
|
import xbmc
|
||||||
|
xbmc.executebuiltin('XBMC.Extract("%s", "%s")' % (torrents_path_zip_file, torrents_path_zip))
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
import os
|
||||||
|
for root, folders, files in os.walk(torrents_path_zip): #Recorremos la carpeta para leer el .torrent
|
||||||
|
for file in files:
|
||||||
|
if file.endswith(".torrent"):
|
||||||
|
input_file = filetools.join(root, file) #nombre del .torrent
|
||||||
|
torrent_file = filetools.read(input_file) #leemos el .torrent
|
||||||
|
|
||||||
|
filetools.rmdirtree(torrents_path_zip) #Borramos la carpeta temporal
|
||||||
|
|
||||||
|
#Si no es un archivo .torrent (RAR, HTML,..., vacío) damos error
|
||||||
|
if not scrapertools.find_single_match(torrent_file, '^d\d+:.*?\d+:'):
|
||||||
logger.error('No es un archivo Torrent: ' + url)
|
logger.error('No es un archivo Torrent: ' + url)
|
||||||
torrents_path = ''
|
torrents_path = ''
|
||||||
if data_torrent:
|
if data_torrent:
|
||||||
return (torrents_path, torrent_file)
|
return (torrents_path, torrent_file)
|
||||||
return torrents_path #Si hay un error, devolvemos el "path" vacío
|
return torrents_path #Si hay un error, devolvemos el "path" vacío
|
||||||
|
|
||||||
|
#Salvamos el .torrent
|
||||||
if not lookup:
|
if not lookup:
|
||||||
if not filetools.write(torrents_path_encode, torrent_file): #Salvamos el .torrent
|
if not filetools.write(torrents_path_encode, torrent_file):
|
||||||
logger.error('ERROR: Archivo .torrent no escrito: ' + torrents_path_encode)
|
logger.error('ERROR: Archivo .torrent no escrito: ' + torrents_path_encode)
|
||||||
torrents_path = '' #Si hay un error, devolvemos el "path" vacío
|
torrents_path = '' #Si hay un error, devolvemos el "path" vacío
|
||||||
torrent_file = '' #... y el buffer del .torrent
|
torrent_file = '' #... y el buffer del .torrent
|
||||||
|
|||||||
@@ -22,8 +22,9 @@ class ziptools:
|
|||||||
self._createstructure(file, dir)
|
self._createstructure(file, dir)
|
||||||
num_files = len(zf.namelist())
|
num_files = len(zf.namelist())
|
||||||
|
|
||||||
for name in zf.namelist():
|
for nameo in zf.namelist():
|
||||||
logger.info("name=%s" % name)
|
name = nameo.replace(':', '_').replace('<', '_').replace('>', '_').replace('|', '_').replace('"', '_').replace('?', '_').replace('*', '_')
|
||||||
|
logger.info("name=%s" % nameo)
|
||||||
if not name.endswith('/'):
|
if not name.endswith('/'):
|
||||||
logger.info("no es un directorio")
|
logger.info("no es un directorio")
|
||||||
try:
|
try:
|
||||||
@@ -62,9 +63,9 @@ class ziptools:
|
|||||||
shutil.copy2(outfilename, os.path.join(backup, os.path.basename(outfilename)))
|
shutil.copy2(outfilename, os.path.join(backup, os.path.basename(outfilename)))
|
||||||
|
|
||||||
outfile = open(outfilename, 'wb')
|
outfile = open(outfilename, 'wb')
|
||||||
outfile.write(zf.read(name))
|
outfile.write(zf.read(nameo))
|
||||||
except:
|
except:
|
||||||
logger.error("Error en fichero " + name)
|
logger.error("Error en fichero " + nameo)
|
||||||
|
|
||||||
def _createstructure(self, file, dir):
|
def _createstructure(self, file, dir):
|
||||||
self._makedirs(self._listdirs(file), dir)
|
self._makedirs(self._listdirs(file), dir)
|
||||||
|
|||||||
@@ -1217,7 +1217,7 @@ def post_tmdb_findvideos(item, itemlist):
|
|||||||
return (item, itemlist)
|
return (item, itemlist)
|
||||||
|
|
||||||
|
|
||||||
def get_torrent_size(url, data_torrent=False):
|
def get_torrent_size(url, referer=None, post=None, data_torrent=False):
|
||||||
logger.info()
|
logger.info()
|
||||||
from core import videolibrarytools
|
from core import videolibrarytools
|
||||||
|
|
||||||
@@ -1230,6 +1230,8 @@ def get_torrent_size(url, data_torrent=False):
|
|||||||
|
|
||||||
Llamada: generictools.get_torrent_size(url, data_torrent=False)
|
Llamada: generictools.get_torrent_size(url, data_torrent=False)
|
||||||
Entrada: url: url del archivo .torrent
|
Entrada: url: url del archivo .torrent
|
||||||
|
Entrada: referer: url de referer en caso de llamada con post
|
||||||
|
Entrada: post: contenido del post en caso de llamada con post
|
||||||
Entrada: data_torrent: Flag por si se quiere el contenido del .torretn de vuelta
|
Entrada: data_torrent: Flag por si se quiere el contenido del .torretn de vuelta
|
||||||
Salida: size: str con el tamaño y tipo de medida ( MB, GB, etc)
|
Salida: size: str con el tamaño y tipo de medida ( MB, GB, etc)
|
||||||
Salida: torrent: dict() con el contenido del .torrent (opcional)
|
Salida: torrent: dict() con el contenido del .torrent (opcional)
|
||||||
@@ -1309,11 +1311,11 @@ def get_torrent_size(url, data_torrent=False):
|
|||||||
#urllib.urlretrieve(url, torrents_path + "/generictools.torrent") #desacargamos el .torrent a la carpeta
|
#urllib.urlretrieve(url, torrents_path + "/generictools.torrent") #desacargamos el .torrent a la carpeta
|
||||||
#torrent_file = open(torrents_path + "/generictools.torrent", "rb").read() #leemos el .torrent
|
#torrent_file = open(torrents_path + "/generictools.torrent", "rb").read() #leemos el .torrent
|
||||||
|
|
||||||
torrents_path, torrent_file = videolibrarytools.caching_torrents(url, timeout=2, lookup=True, data_torrent=True)
|
torrents_path, torrent_file = videolibrarytools.caching_torrents(url, referer=referer, post=post, timeout=2, lookup=True, data_torrent=True)
|
||||||
if not torrent_file:
|
if not torrent_file:
|
||||||
if data_torrent:
|
if data_torrent:
|
||||||
return (size, torrent)
|
return (size, torrent)
|
||||||
return size #Si hay un error, devolvemos el "size" y "torrent" vacíos
|
return size #Si hay un error, devolvemos el "size" y "torrent" vacíos
|
||||||
|
|
||||||
torrent = decode(torrent_file) #decodificamos el .torrent
|
torrent = decode(torrent_file) #decodificamos el .torrent
|
||||||
|
|
||||||
|
|||||||
@@ -696,6 +696,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# se obtiene la información del video.
|
# se obtiene la información del video.
|
||||||
|
mediaurl = alfaresolver.av(mediaurl)
|
||||||
if not item.contentThumbnail:
|
if not item.contentThumbnail:
|
||||||
thumb = item.thumbnail
|
thumb = item.thumbnail
|
||||||
else:
|
else:
|
||||||
@@ -1109,6 +1110,8 @@ def play_torrent(item, xlistitem, mediaurl):
|
|||||||
url = ''
|
url = ''
|
||||||
url_stat = False
|
url_stat = False
|
||||||
torrents_path = ''
|
torrents_path = ''
|
||||||
|
referer = None
|
||||||
|
post = None
|
||||||
videolibrary_path = config.get_videolibrary_path() #Calculamos el path absoluto a partir de la Videoteca
|
videolibrary_path = config.get_videolibrary_path() #Calculamos el path absoluto a partir de la Videoteca
|
||||||
if videolibrary_path.lower().startswith("smb://"): #Si es una conexión SMB, usamos userdata local
|
if videolibrary_path.lower().startswith("smb://"): #Si es una conexión SMB, usamos userdata local
|
||||||
videolibrary_path = config.get_data_path() #Calculamos el path absoluto a partir de Userdata
|
videolibrary_path = config.get_data_path() #Calculamos el path absoluto a partir de Userdata
|
||||||
@@ -1124,7 +1127,11 @@ def play_torrent(item, xlistitem, mediaurl):
|
|||||||
timeout = 10
|
timeout = 10
|
||||||
if item.torrent_alt:
|
if item.torrent_alt:
|
||||||
timeout = 5
|
timeout = 5
|
||||||
url = videolibrarytools.caching_torrents(item.url, torrents_path=torrents_path, timeout=timeout) #Descargamos el .torrent
|
#Si es una llamada con POST, lo preparamos
|
||||||
|
if item.referer: referer = item.referer
|
||||||
|
if item.post: post = item.post
|
||||||
|
#Descargamos el .torrent
|
||||||
|
url = videolibrarytools.caching_torrents(item.url, referer, post, torrents_path=torrents_path, timeout=timeout)
|
||||||
if url:
|
if url:
|
||||||
url_stat = True
|
url_stat = True
|
||||||
item.url = url
|
item.url = url
|
||||||
|
|||||||
Reference in New Issue
Block a user