fix 实时软连接v1.5优化性能,提高处理速度

This commit is contained in:
thsrite
2024-06-21 21:01:47 +08:00
parent 253739f48b
commit bb4b9ee56f
4 changed files with 16 additions and 8 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.4
- 实时软连接 v1.5
- 订阅规则自动填充 v2.7
- Emby元数据刷新 v1.1
- Emby媒体标签 v1.2

View File

@@ -378,11 +378,12 @@
"name": "实时软连接",
"description": "监控目录文件变化,媒体文件软连接,其他文件可选复制。",
"labels": "文件管理",
"version": "1.4",
"version": "1.5",
"icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/softlink.png",
"author": "thsrite",
"level": 1,
"history": {
"v1.5": "优化性能,提高处理速度",
"v1.4": "支持自定义视频格式",
"v1.3": "异步启动"
}

View File

@@ -288,8 +288,11 @@ class CloudAssistant(_PluginBase):
# 遍历所有监控目录
for mon_path in self._dirconf.keys():
# 遍历目录下所有文件
for file_path in SystemUtils.list_files(Path(mon_path), [".*"]):
self.__handle_file(event_path=str(file_path), mon_path=mon_path)
for root, dirs, files in os.walk(mon_path):
for name in dirs + files:
path = os.path.join(root, name)
if Path(path).is_file():
self.__handle_file(event_path=str(path), mon_path=mon_path)
logger.info("云盘助手全量同步监控目录完成!")
def event_handler(self, event, mon_path: str, text: str, event_path: str):

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.4"
plugin_version = "1.5"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -218,7 +218,8 @@ class FileSoftLink(_PluginBase):
"monitor_dirs": self._monitor_dirs,
"exclude_keywords": self._exclude_keywords,
"cron": self._cron,
"size": self._size
"size": self._size,
"rmt_mediaext": self._rmt_mediaext
})
@eventmanager.register(EventType.PluginAction)
@@ -246,8 +247,11 @@ class FileSoftLink(_PluginBase):
# 遍历所有监控目录
for mon_path in self._dirconf.keys():
# 遍历目录下所有文件
for file_path in SystemUtils.list_files(Path(mon_path), ['.*']):
self.__handle_file(event_path=str(file_path), mon_path=mon_path)
for root, dirs, files in os.walk(mon_path):
for name in dirs + files:
path = os.path.join(root, name)
if Path(path).is_file():
self.__handle_file(event_path=str(path), mon_path=mon_path)
logger.info("全量同步监控目录完成!")
def event_handler(self, event, mon_path: str, text: str, event_path: str):