fix 可配置是否存储转移记录

This commit is contained in:
thsrite
2024-04-29 20:55:48 +08:00
parent 0a4cbb46cd
commit df2bdf4196
3 changed files with 38 additions and 19 deletions

View File

@@ -25,7 +25,7 @@ MoviePilot三方插件市场https://github.com/thsrite/MoviePilot-Plugins/
- [Emby观影报告 1.5](docs%2FEmbyReporter.md)
- 演员订阅 1.5
- [短剧刮削 3.2](docs%2FShortPlayMonitor.md)
- 云盘实时监控 2.0
- 云盘实时监控 2.1
- 源文件恢复 1.2
- [微信消息转发 2.2](docs%2FWeChatForward.md)
- 订阅下载统计 1.5

View File

@@ -224,11 +224,12 @@
"name": "云盘实时监控",
"description": "监控云盘目录文件变化,自动转移链接。",
"labels": "云盘",
"version": "2.0",
"version": "2.1",
"icon": "Linkease_A.png",
"author": "thsrite",
"level": 1,
"history": {
"v2.1": "可配置是否存储转移记录",
"v2.0": "修复不刮削不生效bug",
"v1.8": "fix S00转移",
"v1.7": "fix 刮削",

View File

@@ -60,7 +60,7 @@ class CloudLinkMonitor(_PluginBase):
# 插件图标
plugin_icon = "Linkease_A.png"
# 插件版本
plugin_version = "2.0"
plugin_version = "2.1"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -96,6 +96,8 @@ class CloudLinkMonitor(_PluginBase):
_dirconf: Dict[str, Optional[Path]] = {}
# 存储源目录转移方式
_transferconf: Dict[str, Optional[str]] = {}
_scraperconf: Dict[str, Optional[str]] = {}
_historyconf: Dict[str, Optional[str]] = {}
_medias = {}
# 退出事件
_event = threading.Event()
@@ -110,6 +112,7 @@ class CloudLinkMonitor(_PluginBase):
self._dirconf = {}
self._transferconf = {}
self._scraperconf = {}
self._historyconf = {}
# 读取配置
if config:
@@ -142,6 +145,13 @@ class CloudLinkMonitor(_PluginBase):
if not mon_path:
continue
# 是否刮削
_history = True
if mon_path.count("%") == 1:
_scraper_type = mon_path.split("%")[1]
_history = True if _scraper_type == "True" else False
mon_path = mon_path.split("%")[0]
# 是否刮削
_scraper_type = False
if mon_path.count("$") == 1:
@@ -174,6 +184,9 @@ class CloudLinkMonitor(_PluginBase):
else:
self._dirconf[mon_path] = None
# 是否存历史
self._historyconf[mon_path] = _history
# 是否刮削
self._scraperconf[mon_path] = _scraper_type
@@ -370,6 +383,8 @@ class CloudLinkMonitor(_PluginBase):
transfer_type = self._transferconf.get(mon_path)
# 是否刮削
scraper_type = self._scraperconf.get(mon_path)
# 是否存历史
history_type = self._historyconf.get(mon_path)
# 识别媒体信息
mediainfo: MediaInfo = self.chain.recognize_media(meta=file_meta)
@@ -421,14 +436,16 @@ class CloudLinkMonitor(_PluginBase):
if not transferinfo.success:
# 转移失败
logger.warn(f"{file_path.name} 入库失败:{transferinfo.message}")
# 新增转移失败历史记录
self.transferhis.add_fail(
src_path=file_path,
mode=transfer_type,
meta=file_meta,
mediainfo=mediainfo,
transferinfo=transferinfo
)
if history_type:
# 新增转移失败历史记录
self.transferhis.add_fail(
src_path=file_path,
mode=transfer_type,
meta=file_meta,
mediainfo=mediainfo,
transferinfo=transferinfo
)
if self._notify:
self.post_message(
mtype=NotificationType.Manual,
@@ -438,14 +455,15 @@ class CloudLinkMonitor(_PluginBase):
)
return
# 新增转移成功历史记录
self.transferhis.add_success(
src_path=file_path,
mode=transfer_type,
meta=file_meta,
mediainfo=mediainfo,
transferinfo=transferinfo
)
if history_type:
# 新增转移成功历史记录
self.transferhis.add_success(
src_path=file_path,
mode=transfer_type,
meta=file_meta,
mediainfo=mediainfo,
transferinfo=transferinfo
)
# 刮削
if scraper_type: