fix poster

This commit is contained in:
thsrite
2024-01-03 21:11:59 +08:00
parent 14249b2bbd
commit 48763ba9bc

View File

@@ -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}")