From 919bc52d0fefc9863d1834a7e9b62eb647a223bf Mon Sep 17 00:00:00 2001 From: j2331223 Date: Sat, 5 Aug 2017 23:07:45 +0200 Subject: [PATCH 1/4] Mergeado de pelisalacarta-ce el fix de la videoteca --- .../platformcode/xbmc_videolibrary.py | 36 ++++++++----------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/plugin.video.alfa/platformcode/xbmc_videolibrary.py b/plugin.video.alfa/platformcode/xbmc_videolibrary.py index 8bef182c..14abdbdf 100755 --- a/plugin.video.alfa/platformcode/xbmc_videolibrary.py +++ b/plugin.video.alfa/platformcode/xbmc_videolibrary.py @@ -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): From c68371bdb5a108220e644b2f0f5c60b825b1a44d Mon Sep 17 00:00:00 2001 From: j2331223 Date: Sun, 6 Aug 2017 01:03:46 +0200 Subject: [PATCH 2/4] =?UTF-8?q?Arreglada=20la=20actualizaci=C3=B3n=20de=20?= =?UTF-8?q?la=20videolibrary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin.video.alfa/core/channeltools.py | 4 ++++ plugin.video.alfa/videolibrary_service.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin.video.alfa/core/channeltools.py b/plugin.video.alfa/core/channeltools.py index e59dd7b8..0158abdb 100755 --- a/plugin.video.alfa/core/channeltools.py +++ b/plugin.video.alfa/core/channeltools.py @@ -18,6 +18,10 @@ def is_adult(channel_name): channel_parameters = get_channel_parameters(channel_name) return channel_parameters["adult"] +def is_active(channel_name): + logger.info("channel_name=" + channel_name) + channel_parameters = get_channel_parameters(channel_name) + return channel_parameters["active"] def get_channel_parameters(channel_name): global dict_channels_parameters diff --git a/plugin.video.alfa/videolibrary_service.py b/plugin.video.alfa/videolibrary_service.py index 51344bf9..8c3c457a 100644 --- a/plugin.video.alfa/videolibrary_service.py +++ b/plugin.video.alfa/videolibrary_service.py @@ -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,7 +25,7 @@ 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_active = channeltools.is_active(channel) if channel_active: From 5c4b5869a659938fe8f0b7d770e9893ba9ffcc0f Mon Sep 17 00:00:00 2001 From: j2331223 Date: Sun, 6 Aug 2017 09:50:12 +0200 Subject: [PATCH 3/4] =?UTF-8?q?is=5Factive=20tien=20een=20cuenta=20la=20co?= =?UTF-8?q?nfiguraci=C3=B3n=20del=20canal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Da preferencia al setting general --- plugin.video.alfa/core/channeltools.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugin.video.alfa/core/channeltools.py b/plugin.video.alfa/core/channeltools.py index 0158abdb..2c78040b 100755 --- a/plugin.video.alfa/core/channeltools.py +++ b/plugin.video.alfa/core/channeltools.py @@ -20,8 +20,7 @@ def is_adult(channel_name): def is_active(channel_name): logger.info("channel_name=" + channel_name) - channel_parameters = get_channel_parameters(channel_name) - return channel_parameters["active"] + 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 From b86d39ae659829c614ebad239bc5a9ff64173673 Mon Sep 17 00:00:00 2001 From: j2331223 Date: Sun, 6 Aug 2017 13:10:28 +0200 Subject: [PATCH 4/4] Rename "is_active" method to "is_enabled" --- plugin.video.alfa/core/channeltools.py | 2 +- plugin.video.alfa/videolibrary_service.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin.video.alfa/core/channeltools.py b/plugin.video.alfa/core/channeltools.py index 2c78040b..e2c70a8f 100755 --- a/plugin.video.alfa/core/channeltools.py +++ b/plugin.video.alfa/core/channeltools.py @@ -18,7 +18,7 @@ def is_adult(channel_name): channel_parameters = get_channel_parameters(channel_name) return channel_parameters["adult"] -def is_active(channel_name): +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) diff --git a/plugin.video.alfa/videolibrary_service.py b/plugin.video.alfa/videolibrary_service.py index 8c3c457a..dcb57459 100644 --- a/plugin.video.alfa/videolibrary_service.py +++ b/plugin.video.alfa/videolibrary_service.py @@ -25,9 +25,9 @@ def update(path, p_dialog, i, t, serie, overwrite): serie.channel = channel serie.url = url - channel_active = channeltools.is_active(channel) + 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,