From 48763ba9bc4a46660fb2ba39d8a1d5470d51d72c Mon Sep 17 00:00:00 2001 From: thsrite Date: Wed, 3 Jan 2024 21:11:59 +0800 Subject: [PATCH] fix poster --- plugins/shortplaymonitor/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/shortplaymonitor/__init__.py b/plugins/shortplaymonitor/__init__.py index b9d80b0..3138409 100644 --- a/plugins/shortplaymonitor/__init__.py +++ b/plugins/shortplaymonitor/__init__.py @@ -279,7 +279,15 @@ class ShortPlayMonitor(_PluginBase): if not (target_path.parent / "poster.jpg").exists(): thumb_path = self.gen_file_thumb(file_path=target_path, cover_conf=cover_conf) - SystemUtils.move(thumb_path, target_path.parent / "poster.jpg") + if thumb_path and Path(thumb_path).exists(): + SystemUtils.move(thumb_path, target_path.parent / "poster.jpg") + else: + # 检查是否有缩略图 + thumb_files = SystemUtils.list_files(directory=target_path.parent, + extensions=[".jpg"]) + if thumb_files: + for thumb in thumb_files: + SystemUtils.move(thumb, target_path.parent / "poster.jpg") else: logger.error(f"文件 {event_path} 硬链接失败,错误码:{retcode}")