Update handler.py

This commit is contained in:
ForgQi committed 2024-03-02 21:55:31 +08:00
1 parent 9a8e4a6616
commit 67cd81fc52
1 file changed
+5 -2
+5 -2
View File
@@ -39,7 +39,7 @@ def singleton_check(platform, name, url):
yield Event(PRE_DOWNLOAD, args=(name, turl,))
return
if context['PluginInfo'].url_status[url] == 1:
logger.debug(f'{url}-{url}-正在下载中,跳过检测')
logger.debug(f'{url}正在下载中,跳过检测')
return
# 可能对同一个url同时发送两次上传事件
with NamedLock(f"upload_count_{url}"):
@@ -51,12 +51,14 @@ def singleton_check(platform, name, url):
if platform(name, url).check_stream(True):
# 需要等待上传文件列表检索完成后才可以开始下次下载
with NamedLock(f'upload_file_list_{name}'):
context['PluginInfo'].url_status[url] = 1
yield Event(PRE_DOWNLOAD, args=(name, url,))
@event_manager.register(PRE_DOWNLOAD, block='Asynchronous1')
def pre_processor(name, url):
if context['PluginInfo'].url_status[url] == 1:
logger.debug(f'{name}-正在下载中,跳过下载')
return
logger.info(f'{name}-{url}-开播了准备下载')
preprocessor = config['streamers'].get(name, {}).get('preprocessor')
if preprocessor:
@@ -81,6 +83,7 @@ def process(name, url):
suffix = kwargs.get('format')
if suffix:
kwargs['suffix'] = suffix
url_status[url] = 1
stream_info = download(name, url, **kwargs)
except Exception as e:
logger.exception(f"下载错误: {stream_info['name']} - {e}")