Launcher: evita bloqueo en Kodi en "Ajuste de tasa refresco de pantalla"

Kodi se bloqueaba en el pseudo "play" del vídeo "subtitle".
Hay que poner un "sleep(0.5)" antes del Stop
This commit is contained in:
Kingbox
2019-03-15 15:49:13 +01:00
parent e7b24c54b5
commit cbe616da37
4 changed files with 523 additions and 495 deletions
+1 -1
View File
@@ -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": "http://www.mejortorrent.org/", "default": "http://www.mejortorrent.tv/",
"enabled": true, "enabled": true,
"visible": true "visible": true
}, },
+23 -13
View File
@@ -26,7 +26,8 @@ list_servers = ['torrent']
channel = "mejortorrent" channel = "mejortorrent"
host = 'http://www.mejortorrent.org/' host = 'http://www.mejortorrent.tv/'
host_sufix = '.tv'
#host = config.get_setting('domain_name', channel) #host = config.get_setting('domain_name', channel)
categoria = channel.capitalize() categoria = channel.capitalize()
@@ -296,8 +297,8 @@ def listado(item):
item_local.title = scrapertools.get_match(scrapedurl, patron_enlace) item_local.title = scrapertools.get_match(scrapedurl, patron_enlace)
item_local.title = item_local.title.replace("-", " ") item_local.title = item_local.title.replace("-", " ")
item_local.url = urlparse.urljoin(item_local.url, scrapedurl) item_local.url = verificar_url(urlparse.urljoin(item_local.url, scrapedurl))
item_local.thumbnail = host + urllib.quote(scrapedthumbnail) item_local.thumbnail = verificar_url(host + urllib.quote(scrapedthumbnail))
item_local.contentThumbnail = item_local.thumbnail item_local.contentThumbnail = item_local.thumbnail
item_local.infoLabels['year'] = '-' # Al no saber el año, le ponemos "-" y TmDB lo calcula automáticamente item_local.infoLabels['year'] = '-' # Al no saber el año, le ponemos "-" y TmDB lo calcula automáticamente
@@ -660,7 +661,7 @@ def listado_busqueda(item):
item_local.quality = scrapertools.remove_htmltags(scrapedinfo).decode('iso-8859-1').encode('utf8') item_local.quality = scrapertools.remove_htmltags(scrapedinfo).decode('iso-8859-1').encode('utf8')
item_local.quality = item_local.quality.replace("(", "").replace(")", "").replace("[", "").replace("]", "").replace("Documental", "").replace("documental", "") item_local.quality = item_local.quality.replace("(", "").replace(")", "").replace("[", "").replace("]", "").replace("Documental", "").replace("documental", "")
item_local.url = urlparse.urljoin(item.url, scrapedurl) item_local.url = verificar_url(urlparse.urljoin(item.url, scrapedurl))
#Preparamos la información básica para TMDB #Preparamos la información básica para TMDB
if "/serie-" in scrapedurl or "/doc-" in scrapedurl: if "/serie-" in scrapedurl or "/doc-" in scrapedurl:
@@ -829,10 +830,10 @@ def findvideos(item):
for scrapedurl in matches: for scrapedurl in matches:
#Generamos una copia de Item para trabajar sobre ella #Generamos una copia de Item para trabajar sobre ella
item_local = item.clone() item_local = item.clone()
url = urlparse.urljoin(item.url, scrapedurl) url = verificar_url(urlparse.urljoin(item.url, scrapedurl))
# Localiza el .torrent en el siguiente link # Localiza el .torrent en el siguiente link
if not item.post and not item.armagedon: # Si no es llamada con Post, hay que bajar un nivel más if not item.post and not item.armagedon: # Si no es llamada con Post, hay que bajar un nivel más
try: try:
torrent_data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(url).data) torrent_data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(url).data)
except: #error except: #error
@@ -849,15 +850,15 @@ def findvideos(item):
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
#logger.debug(torrent_data) #logger.debug(torrent_data)
if not item.armagedon: if not item.armagedon:
item_local.url = scrapertools.get_match(torrent_data, ">Pincha.*?<a href='(.*?\/uploads\/torrents\/\w+\/.*?\.torrent)'") item_local.url = scrapertools.get_match(torrent_data, ">Pincha.*?<a href='(.*?\/uploads\/torrents\/\w+\/.*?\.torrent)'")
item_local.url = urlparse.urljoin(url, item_local.url) item_local.url = verificar_url(urlparse.urljoin(url, item_local.url))
elif not item.armagedon: elif not item.armagedon:
item_local.url = url # Ya teníamos el link desde el primer nivel (documentales) item_local.url = url # Ya teníamos el link desde el primer nivel (documentales)
item_local.url = item_local.url.replace(" ", "%20") item_local.url = item_local.url.replace(" ", "%20")
if item.armagedon and item.emergency_urls and not item.videolibray_emergency_urls: if item.armagedon and item.emergency_urls and not item.videolibray_emergency_urls:
@@ -867,10 +868,10 @@ def findvideos(item):
del item.emergency_urls[0][0] del item.emergency_urls[0][0]
if not item.armagedon and item.emergency_urls and not item.videolibray_emergency_urls: if not item.armagedon and item.emergency_urls and not item.videolibray_emergency_urls:
if len(item.emergency_urls[0]): if len(item.emergency_urls[0]):
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la primera url del .Torrent ALTERNATIVA item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la primera url del .Torrent ALTERNATIVA
if item.videolibray_emergency_urls: if item.videolibray_emergency_urls:
item.emergency_urls[0].append(item_local.url) #Salvamnos la url... item.emergency_urls[0].verificar_url(append(item_local.url)) #Salvamnos la url...
# Poner la calidad, si es necesario # Poner la calidad, si es necesario
if not item_local.quality: if not item_local.quality:
@@ -1003,7 +1004,7 @@ def episodios(item):
item_local.title = '' item_local.title = ''
item_local.context = "['buscar_trailer']" item_local.context = "['buscar_trailer']"
item_local.url = urlparse.urljoin(host, scrapedurl) item_local.url = verificar_url(urlparse.urljoin(host, scrapedurl))
scrapedtitle = re.sub('\r\n', '', scrapedtitle).decode('iso-8859-1').encode('utf8').strip() scrapedtitle = re.sub('\r\n', '', scrapedtitle).decode('iso-8859-1').encode('utf8').strip()
if scrapedtitle.endswith('.'): if scrapedtitle.endswith('.'):
@@ -1030,7 +1031,7 @@ def episodios(item):
else: #Se prepara el Post para documentales else: #Se prepara el Post para documentales
item_local.contentSeason = 1 item_local.contentSeason = 1
item_local.contentEpisodeNumber = 1 item_local.contentEpisodeNumber = 1
item_local.url = host + "/secciones.php?sec=descargas&ap=contar_varios" item_local.url = verificar_url(host + "/secciones.php?sec=descargas&ap=contar_varios")
item_local.post = urllib.urlencode({name: value, "total_capis": total_capis, "tabla": tabla, "titulo": titulo_post}) item_local.post = urllib.urlencode({name: value, "total_capis": total_capis, "tabla": tabla, "titulo": titulo_post})
if year: if year:
@@ -1052,6 +1053,15 @@ def episodios(item):
return itemlist return itemlist
def verificar_url(url):
if '.com' in url or '.net' in url or '.org' in url:
url = url.replace('.com', '.tv').replace('.net', '.tv').replace('.org', '.tv')
url = url.replace('torrents/tmp/torrent.php?table=peliculas/&name=', 'torrents/peliculas/')
url = url.replace('torrents/tmp/torrent.php?table=series/&name=', 'torrents/series/')
url = url.replace('torrents/tmp/torrent.php?table=documentales/&name=', 'torrents/documentales/')
return url
def actualizar_titulos(item): def actualizar_titulos(item):
logger.info() logger.info()
itemlist = [] itemlist = []
+21 -5
View File
@@ -7,6 +7,7 @@ import urlparse
import datetime import datetime
import ast import ast
import random import random
import traceback
from channelselector import get_thumb from channelselector import get_thumb
from core import httptools from core import httptools
@@ -700,8 +701,12 @@ def listado(item):
#Guardamos el resto de variables del vídeo #Guardamos el resto de variables del vídeo
item_local.url = scrapedurl item_local.url = scrapedurl
if not item_local.url.startswith("http"): #Si le falta el http.: lo ponemos
item_local.url = scrapertools.find_single_match(item_local.channel_host, '(\w+:)//') + item_local.url
item_local.thumbnail = scrapedthumbnail item_local.thumbnail = scrapedthumbnail
item_local.contentThumbnail = scrapedthumbnail if not item_local.thumbnail.startswith("http"): #Si le falta el http.: lo ponemos
item_local.thumbnail = scrapertools.find_single_match(item_local.channel_host, '(\w+:)//') + item_local.thumbnail
item_local.contentThumbnail = item_local.thumbnail
#Guardamos el año que puede venir en la url, por si luego no hay resultados desde TMDB #Guardamos el año que puede venir en la url, por si luego no hay resultados desde TMDB
year = '' year = ''
@@ -1008,7 +1013,7 @@ def listado_busqueda(item):
if not data_serie: #Si no ha logrado encontrar nada, salimos if not data_serie: #Si no ha logrado encontrar nada, salimos
title_subs += ["ERR"] title_subs += ["ERR"]
elif item_local.channel_alt: #Si ha habido fail-over, lo comento elif item_local.channel_alt: #Si ha habido fail-over, lo comento
url = url.replace(item_local.channel_alt, item_local.category.lower()) url = url.replace(item_local.channel_alt, item_local.category.lower())
title_subs += ["ALT"] title_subs += ["ALT"]
@@ -1029,7 +1034,9 @@ def listado_busqueda(item):
title_subs += ["Episodio %sx%s" % (scrapertools.find_single_match(url, '\/temp.*?-(\d+)-?\/cap.*?-(\d+(?:-al-\d+)?)-?\/'))] title_subs += ["Episodio %sx%s" % (scrapertools.find_single_match(url, '\/temp.*?-(\d+)-?\/cap.*?-(\d+(?:-al-\d+)?)-?\/'))]
url = item_local.url url = item_local.url
except: except:
pass logger.error(traceback.format_exc())
#logger.debug(item_local.url)
if item.extra == "novedades" and "/serie" in url: if item.extra == "novedades" and "/serie" in url:
if not item_local.url or episodio_serie == 0: if not item_local.url or episodio_serie == 0:
@@ -1204,8 +1211,12 @@ def listado_busqueda(item):
#Guardamos el resto de variables del vídeo #Guardamos el resto de variables del vídeo
item_local.url = url item_local.url = url
if not item_local.url.startswith("http"): #Si le falta el http.: lo ponemos
item_local.url = scrapertools.find_single_match(item_local.channel_host, '(\w+:)//') + item_local.url
item_local.thumbnail = scrapedthumbnail item_local.thumbnail = scrapedthumbnail
item_local.contentThumbnail = scrapedthumbnail if not item_local.thumbnail.startswith("http"): #Si le falta el http.: lo ponemos
item_local.thumbnail = scrapertools.find_single_match(item_local.channel_host, '(\w+:)//') + item_local.thumbnail
item_local.contentThumbnail = item_local.thumbnail
#Guardamos el año que puede venir en la url, por si luego no hay resultados desde TMDB #Guardamos el año que puede venir en la url, por si luego no hay resultados desde TMDB
try: try:
@@ -2019,7 +2030,12 @@ def episodios(item):
item_local = item.clone() #Creamos copia local de Item por episodio item_local = item.clone() #Creamos copia local de Item por episodio
item_local.url = url item_local.url = url
item_local.contentThumbnail = thumb if not item_local.url.startswith("http"): #Si le falta el http.: lo ponemos
item_local.url = scrapertools.find_single_match(item_local.channel_host, '(\w+:)//') + item_local.url
item_local.thumbnail = thumb
if not item_local.thumbnail.startswith("http"): #Si le falta el http.: lo ponemos
item_local.thumbnail = scrapertools.find_single_match(item_local.channel_host, '(\w+:)//') + item_local.thumbnail
item_local.contentThumbnail = item_local.thumbnail
estado = True #Buena calidad de datos por defecto estado = True #Buena calidad de datos por defecto
if "<span" in info: # new style if "<span" in info: # new style
+3 -1
View File
@@ -392,12 +392,15 @@ def play_from_library(item):
import xbmcgui import xbmcgui
import xbmcplugin import xbmcplugin
import xbmc import xbmc
from time import sleep
# Intentamos reproducir una imagen (esto no hace nada y ademas no da error) # Intentamos reproducir una imagen (esto no hace nada y ademas no da error)
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcplugin.setResolvedUrl(int(sys.argv[1]), True,
xbmcgui.ListItem( xbmcgui.ListItem(
path=os.path.join(config.get_runtime_path(), "resources", "subtitle.mp4"))) path=os.path.join(config.get_runtime_path(), "resources", "subtitle.mp4")))
# Por si acaso la imagen hiciera (en futuras versiones) le damos a stop para detener la reproduccion # Por si acaso la imagen hiciera (en futuras versiones) le damos a stop para detener la reproduccion
sleep(0.5) ### Si no se pone esto se bloquea Kodi
xbmc.Player().stop() xbmc.Player().stop()
# modificamos el action (actualmente la videoteca necesita "findvideos" ya que es donde se buscan las fuentes # modificamos el action (actualmente la videoteca necesita "findvideos" ya que es donde se buscan las fuentes
@@ -421,7 +424,6 @@ def play_from_library(item):
while platformtools.is_playing(): while platformtools.is_playing():
# Ventana convencional # Ventana convencional
from time import sleep
sleep(5) sleep(5)
p_dialog.update(50, '') p_dialog.update(50, '')