Cacheo de enlace: nuevos canales y mejoras

Cacheo de enlaces:
- Mejores controles para el cacheo de enlaces para el contenido existiente en la Videoteca.
- Opción para cachear los archivos .torrent y almacenarlos en la Videoteca
- Mejoras en el "play" de enlaces torrent: ahora descarga siempre los .torrent en local y pasa al cliente Torrent el .torret descargado
- Usando la técnica anterior, permite al canal usar un enlace Torrent alternativo por si el enlace torrent principal no está activo.  El "play" de enlaces torrent seleciona automáticamente el .torrent alternativo si el principal no funciona.

Nuevos canales añadidos al cacheo de enlaces:
- DivxTotal
- EliteTorrent
- GranTorrent

Mejorado:
- Newpct1 (mejorada la Alta Disponibilidad en Findvideos)
This commit is contained in:
Kingbox
2018-11-07 14:21:13 +01:00
parent 615f0e3aa0
commit b51399e132
13 changed files with 689 additions and 195 deletions

View File

@@ -1061,6 +1061,9 @@ def torrent_client_installed(show_tuple=False):
def play_torrent(item, xlistitem, mediaurl):
logger.info()
import time
from core import filetools
from core import httptools
from core import videolibrarytools
# Opciones disponibles para Reproducir torrents
torrent_options = list()
@@ -1090,6 +1093,36 @@ def play_torrent(item, xlistitem, mediaurl):
xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xlistitem) #Preparamos el entorno para evitar error Kod1 18
time.sleep(0.5) #Dejamos tiempo para que se ejecute
#Nuevo método de descarga previa del .torrent. Si da error, miramos si hay alternatica local. Si ya es local, lo usamos
url_stat = False
videolibrary_path = config.get_videolibrary_path() #Calculamos el path absoluto a partir de la Videoteca
if not filetools.exists(videolibrary_path): #Si no existe el path, pasamos al modo clásico
url_stat = True
elif not filetools.exists(videolibrary_path + 'temp_torrents_Alfa'): #Si no existe la carpeta temporal para .torrents, la creamos
filetools.mkdir(videolibrary_path + 'temp_torrents_Alfa')
torrents_path = filetools.join(videolibrary_path, 'temp_torrents_Alfa', 'cliente_torrent_Alfa.torrent') #path de descarga temporal
#identificamos si es una url o un path de archivo. Los Magnets los tratamos de la forma clásica
if not item.url.startswith("\\") and not item.url.startswith("/") and not item.url.startswith("magnet:") and not url_stat:
timeout = 10
if item.torrent_alt:
timeout = 5
item.url = videolibrarytools.caching_torrents(item.url, torrents_path=torrents_path, timeout=timeout) #Descargamos el .torrent
if item.url: url_stat = True
if not item.url and item.torrent_alt: #Si hay error, se busca un .torrent alternativo
item.url = item.torrent_alt #El .torrent alternativo puede estar en una url o en local
#Si es un archivo .torrent local, actualizamos el path relativo a path absoluto
if item.url.startswith("\\") or item.url.startswith("/") and not url_stat: #.torrent alternativo local
movies = config.get_setting("folder_movies")
series = config.get_setting("folder_tvshows")
if item.contentType == 'movie':
folder = movies #películas
else:
folder = series #o series
item.url = filetools.join(videolibrary_path, folder, item.url) #dirección del .torrent local en la Videoteca
mediaurl = urllib.quote_plus(item.url)
#Llamada con más parámetros para completar el título
if ("quasar" in torrent_options[seleccion][1] or "elementum" in torrent_options[seleccion][1]) and item.infoLabels['tmdb_id']: