Merge pull request #15 from j2331223/videoteca-concurrente
Mergeado de pelisalacarta-ce el fix de la videoteca + fix de búsqueda de nuevos episodios.
This commit is contained in:
@@ -18,6 +18,9 @@ def is_adult(channel_name):
|
||||
channel_parameters = get_channel_parameters(channel_name)
|
||||
return channel_parameters["adult"]
|
||||
|
||||
def is_enabled(channel_name):
|
||||
logger.info("channel_name=" + channel_name)
|
||||
return get_channel_parameters(channel_name)["active"] and get_channel_setting("enabled", channel = channel_name, default = True)
|
||||
|
||||
def get_channel_parameters(channel_name):
|
||||
global dict_channels_parameters
|
||||
|
||||
@@ -375,31 +375,20 @@ def update(folder_content=config.get_setting("folder_tvshows"), folder=""):
|
||||
"""
|
||||
logger.info(folder)
|
||||
|
||||
if not folder:
|
||||
# Actualizar toda la coleccion
|
||||
while xbmc.getCondVisibility('Library.IsScanningVideo()'):
|
||||
xbmc.sleep(500)
|
||||
xbmc.executebuiltin('UpdateLibrary(video)')
|
||||
|
||||
else:
|
||||
# Actualizar una sola carpeta en un hilo independiente
|
||||
|
||||
def update_multi_threads(update_path, lock):
|
||||
lock.acquire()
|
||||
# logger.debug("%s\nINICIO" % update_path)
|
||||
payload = {"jsonrpc": "2.0",
|
||||
"method": "VideoLibrary.Scan",
|
||||
"params": {"directory": update_path}, "id": 1}
|
||||
|
||||
data = get_data(payload)
|
||||
lock.release()
|
||||
# logger.debug("%s\nFIN data: %s" % (update_path, data))
|
||||
payload = {
|
||||
"jsonrpc": "2.0",
|
||||
"method": "VideoLibrary.Scan",
|
||||
"id": 1
|
||||
}
|
||||
|
||||
if folder:
|
||||
videolibrarypath = config.get_videolibrary_config_path()
|
||||
|
||||
if folder.endswith('/') or folder.endswith('\\'):
|
||||
folder = folder[:-1]
|
||||
|
||||
update_path = None
|
||||
|
||||
if videolibrarypath.startswith("special:"):
|
||||
if videolibrarypath.endswith('/'):
|
||||
videolibrarypath = videolibrarypath[:-1]
|
||||
@@ -407,9 +396,12 @@ def update(folder_content=config.get_setting("folder_tvshows"), folder=""):
|
||||
else:
|
||||
update_path = filetools.join(videolibrarypath, folder_content, folder) + "/"
|
||||
|
||||
t = threading.Thread(target=update_multi_threads, args=[update_path, threading.Lock()])
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
payload["params"] = {"directory": update_path}
|
||||
|
||||
while xbmc.getCondVisibility('Library.IsScanningVideo()'):
|
||||
xbmc.sleep(500)
|
||||
|
||||
data = get_data(payload)
|
||||
|
||||
|
||||
def clean(mostrar_dialogo=False):
|
||||
|
||||
@@ -11,6 +11,7 @@ import threading
|
||||
from core import config
|
||||
from core import filetools
|
||||
from core import logger
|
||||
from core import channeltools
|
||||
from core import videolibrarytools
|
||||
from platformcode import platformtools
|
||||
|
||||
@@ -24,9 +25,9 @@ def update(path, p_dialog, i, t, serie, overwrite):
|
||||
serie.channel = channel
|
||||
serie.url = url
|
||||
|
||||
channel_active = config.get_setting("active", channel=channel, default=False)
|
||||
channel_enabled = channeltools.is_enabled(channel)
|
||||
|
||||
if channel_active:
|
||||
if channel_enabled:
|
||||
|
||||
heading = 'Actualizando videoteca....'
|
||||
p_dialog.update(int(math.ceil((i + 1) * t)), heading, "%s: %s" % (serie.contentSerieName,
|
||||
|
||||
Reference in New Issue
Block a user