Merge pull request #355 from thsrite/main

This commit is contained in:
jxxghp
2024-06-02 11:17:03 +08:00
committed by GitHub
2 changed files with 19 additions and 3 deletions

View File

@@ -75,11 +75,12 @@
"name": "目录监控",
"description": "监控目录文件发生变化时实时整理到媒体库。",
"labels": "文件整理",
"version": "2.2",
"version": "2.3",
"icon": "directory.png",
"author": "jxxghp",
"level": 1,
"history": {
"v2.3": "特殊场景下补充转移成功历史记录",
"v2.2": "更新目录设置说明",
"v2.1": "增加了元数据刮削开关,升级后需要手动打开,否则默认不刮削",
"v2.0": "增强API安全性",

View File

@@ -59,7 +59,7 @@ class DirMonitor(_PluginBase):
# 插件图标
plugin_icon = "directory.png"
# 插件版本
plugin_version = "2.2"
plugin_version = "2.3"
# 插件作者
plugin_author = "jxxghp"
# 作者主页
@@ -174,7 +174,8 @@ class DirMonitor(_PluginBase):
try:
if target_path and target_path.is_relative_to(Path(mon_path)):
logger.warn(f"{target_path} 是监控目录 {mon_path} 的子目录,无法监控")
self.systemmessage.put(f"{target_path} 是下载目录 {mon_path} 的子目录,无法监控", title="目录监控")
self.systemmessage.put(f"{target_path} 是下载目录 {mon_path} 的子目录,无法监控",
title="目录监控")
continue
except Exception as e:
logger.debug(str(e))
@@ -429,6 +430,20 @@ class DirMonitor(_PluginBase):
return
if not transferinfo.success:
# 判断是否转移后文件已存在,补充转移成功历史记录
if transferinfo.target_path and transferinfo.target_path.exists():
logger.info(f"{file_path.name} 目标文件已存在,补充转移成功历史记录")
# 补充转移成功历史记录
self.transferhis.add_success(
src_path=file_path,
mode=transfer_type,
download_hash=download_hash,
meta=file_meta,
mediainfo=mediainfo,
transferinfo=transferinfo
)
return
# 转移失败
logger.warn(f"{file_path.name} 入库失败:{transferinfo.message}")
# 新增转移失败历史记录