From cd6462071dc84d205cdafacd4d963d41b7e13fdf Mon Sep 17 00:00:00 2001 From: thsrite Date: Mon, 26 Aug 2024 14:25:04 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=8E=B7=E5=8F=96emby=E6=97=A5=E5=BF=97?= =?UTF-8?q?=20=E6=9C=80=E6=96=B0200=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/embydanmu/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/embydanmu/__init__.py b/plugins/embydanmu/__init__.py index 4830f93..e2a4607 100644 --- a/plugins/embydanmu/__init__.py +++ b/plugins/embydanmu/__init__.py @@ -610,7 +610,7 @@ class EmbyDanmu(_PluginBase): def __get_emby_log(self) -> str: """ - 获取emby日志 + 获取emby日志 最新200行 """ if not self._EMBY_HOST or not self._EMBY_APIKEY: return "" @@ -618,7 +618,9 @@ class EmbyDanmu(_PluginBase): self._EMBY_HOST, self._EMBY_APIKEY) with RequestUtils().get_res(req_url) as res: if res: - return res.text + emby_log = res.text.split("\n") + emby_log = emby_log[-200:] + return "\n".join(emby_log) else: logger.info(f"获取插件详情失败,无法连接Emby!") return "" @@ -639,6 +641,12 @@ class EmbyDanmu(_PluginBase): if not matches: all_matched = False break + + pattern = fr'\[{source}\]弹幕内容少于1KB,忽略处理:.{item_name}' + matches = re.findall(pattern, emby_log) + if not matches: + all_matched = False + break return all_matched @staticmethod