fix 增强交互命令

This commit is contained in:
thsrite
2024-07-06 18:49:44 +08:00
parent d613c65e84
commit 57af1f79b7
3 changed files with 26 additions and 15 deletions

View File

@@ -33,7 +33,7 @@ MoviePilot三方插件市场https://github.com/thsrite/MoviePilot-Plugins/
- [自定义命令 v1.7](docs%2FCustomCommand.md)
- docker自定义任务 v1.3
- 插件彻底卸载 v1.0
- 实时软连接 v1.9
- 实时软连接 v1.9.1
- 订阅规则自动填充 v2.7
- Emby元数据刷新 v1.3
- Emby媒体标签 v1.2

View File

@@ -384,11 +384,12 @@
"name": "实时软连接",
"description": "监控目录文件变化,媒体文件软连接,其他文件可选复制。",
"labels": "文件管理",
"version": "1.9",
"version": "1.9.1",
"icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/softlink.png",
"author": "thsrite",
"level": 1,
"history": {
"v1.9.1": "增强交互命令",
"v1.9": "交互命令定向软连接",
"v1.8": "修复bug",
"v1.6": "bug修复",

View File

@@ -52,7 +52,7 @@ class FileSoftLink(_PluginBase):
# 插件图标
plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/softlink.png"
# 插件版本
plugin_version = "1.9"
plugin_version = "1.9.1"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -251,24 +251,34 @@ class FileSoftLink(_PluginBase):
if not args:
return
# 使用正则表达式匹配
match = re.match(r'(.*?)\s+(.*)', args)
if match:
parent_dir = match.group(1) # 国漫
args = match.group(2) # 凡人修仙传 (2020)
else:
parent_dir = args
# 定向处理文件夹
# 遍历所有监控目录
for mon_path in self._dirconf.keys():
for root, dirs, files in os.walk(mon_path):
for dir_name in dirs:
src_path = os.path.join(root, dir_name)
src_name = Path(src_path).name
if str(src_name) == str(args):
logger.info(f"开始定向处理文件夹 ...{src_path}")
for sroot, sdirs, sfiles in os.walk(src_path):
for file_name in sdirs + sfiles:
src_file = os.path.join(sroot, file_name)
if Path(src_file).is_file():
self.__handle_file(event_path=str(src_file), mon_path=mon_path)
if event:
self.post_message(channel=event.event_data.get("channel"),
title=f"{args} 软连接完成!", userid=event.event_data.get("user"))
return
# 定向上级文件夹
if str(parent_dir) in str(src_path):
src_name = Path(src_path).name
if str(src_name) == str(args):
logger.info(f"开始定向处理文件夹 ...{src_path}")
for sroot, sdirs, sfiles in os.walk(src_path):
for file_name in sdirs + sfiles:
src_file = os.path.join(sroot, file_name)
if Path(src_file).is_file():
self.__handle_file(event_path=str(src_file), mon_path=mon_path)
if event:
self.post_message(channel=event.event_data.get("channel"),
title=f"{args} 软连接完成!", userid=event.event_data.get("user"))
return
def sync_all(self):
"""