diff --git a/docs/CloudAssistant.md b/docs/CloudAssistant.md index a57e0a8..4f2b38b 100644 --- a/docs/CloudAssistant.md +++ b/docs/CloudAssistant.md @@ -16,12 +16,12 @@ "dest_path": "/mnt/link/movies", "mount_path": "/mnt/cloud/115/media/movies", "return_path": "/mnt/softlink/movies", - "delete_local": "false", - "local_preserve_hierarchy": 0, + "delete_dest": "false", + "dest_preserve_hierarchy": 0, "delete_history": "false", - "delete_source": "false", + "delete_src": "false", "src_paths": "/mnt/media/movies, /mnt/media/series", - "source_preserve_hierarchy": 0, + "src_preserve_hierarchy": 0, "just_media": "true", "overwrite": "false", "upload_cloud": "true" @@ -44,12 +44,12 @@ "cloud_path": "/CloudNas", "cloud_url": "http://localhost:19798", "cloud_scheme": "http/https", - "delete_local": "false", - "local_preserve_hierarchy": 0, + "delete_dest": "false", + "dest_preserve_hierarchy": 0, "delete_history": "false", - "delete_source": "false", + "delete_src": "false", "src_paths": "/mnt/media/movies, /mnt/media/series", - "source_preserve_hierarchy": 0, + "src_preserve_hierarchy": 0, "just_media": "true", "overwrite": "false", "upload_cloud": "true" @@ -71,12 +71,12 @@ cd2方式上传--softlink回本地(暂时移除) "mount_path": "/mnt/cloud/115/media/movies", "cd2_path": "/115/media/movies", "return_path": "/mnt/softlink/movies", - "delete_local": "false", - "local_preserve_hierarchy": 0, + "delete_dest": "false", + "dest_preserve_hierarchy": 0, "delete_history": "false", - "delete_source": "false", + "delete_src": "false", "src_paths": "/mnt/media/movies, /mnt/media/series", - "source_preserve_hierarchy": 0, + "src_preserve_hierarchy": 0, "just_media": "true", "overwrite": "false", "upload_cloud": "true" @@ -102,12 +102,12 @@ cd2方式上传--strm回本地(暂时移除) "cloud_path": "/CloudNas", "cloud_url": "http://localhost:19798", "cloud_scheme": "http/https", - "delete_local": "false", - "local_preserve_hierarchy": 0, + "delete_dest": "false", + "dest_preserve_hierarchy": 0, "delete_history": "false", - "delete_source": "false", + "delete_src": "false", "src_paths": "/mnt/media/movies, /mnt/media/series", - "source_preserve_hierarchy": 0, + "src_preserve_hierarchy": 0, "just_media": "true", "overwrite": "false", "upload_cloud": "true" @@ -117,26 +117,26 @@ cd2方式上传--strm回本地(暂时移除) ``` - - return_mode: 云盘文件回本地模式:softlink/strm -- cd2_url:cd2地址 -- username:cd2用户名 -- password:cd2密码 +- return_path:MoviePilot中软链接/strm生成路径 + +- monitor_mode:监控模式 compatibility/fast - tranfer_type:转移类型,可选值:copy/move - dest_path: MoviePilot本地刮削好的文件路径(MoviePilot媒体库目录) - mount_path:MoviePilot中云盘挂载路径 -- cd2_path:cd2中云盘挂载路径 -- return_path:MoviePilot中软链接/strm生成路径 -- monitor_mode:监控模式 compatibility/fast -- delete_local:是否删除本地文件 -- local_preserve_hierarchy:保留监控路径目录层级,例如 1:表示保留监控目录后一层目录结构,0:表示仅保留到监控目录 + +- delete_dest:是否删除媒体库文件 +- dest_preserve_hierarchy:保留监控路径目录层级,例如 1:表示保留监控目录后一层目录结构,0:表示仅保留到监控目录 + - delete_history:是否删除MoviePilot中转移历史记录 -- delete_source:是否删除源文件,仅上述监控路径查询到转移记录时才生效,删除转移记录的源文件路径 + +- delete_src:是否删除源文件,仅上述监控路径查询到转移记录时才生效,删除转移记录的源文件路径 - src_paths:转移前的源文件路径,多个目录用逗号分隔(MoviePilot下载目录) -- source_preserve_hierarchy:保留源文件路径目录层级,0:表示仅监控到源文件目录,1:表示监控源文件目录及其一级子目录 +- src_preserve_hierarchy:保留源文件路径目录层级,0:表示仅监控到源文件目录,1:表示监控源文件目录及其一级子目录 +- - just_media:是否只监控媒体文件 - overwrite:是否覆盖已存在云盘文件 -- upload_cloud: 是否上传到云盘,false则直接软连接或者strm回本地 +- upload_cloud: 是否上传到云盘, false则直接软连接或者strm回本地 - strm配置具体看[CloudStrm.md](CloudStrm.md) - library_dir:strm模式下,媒体服务器内源文件路径 @@ -144,6 +144,11 @@ cd2方式上传--strm回本地(暂时移除) - cloud_path:strm模式下,cd2/alist挂载本地跟路径 - cloud_url:strm模式下,cd2/alist地址 - cloud_scheme:strm模式下,cd2/alist地址 http/https(strm模式可参考云盘Strm生成插件) +- +[//]: # (- cd2_url:cd2地址) +[//]: # (- username:cd2用户名) +[//]: # (- password:cd2密码) +[//]: # (- cd2_path:cd2中云盘挂载路径) 路径: diff --git a/package.json b/package.json index 27eccb4..33f63af 100644 --- a/package.json +++ b/package.json @@ -526,7 +526,7 @@ "author": "thsrite", "level": 3, "history": { - "v2.0.1": "修改参数名local_path->dest_path、source_dirs->src_paths", + "v2.0.1": "修改若看参数名,具体看教程", "v2.0": "调整通知图片", "v1.9": "修复非媒体文件转移bug(需要主程序1.9.9+)", "v1.8": "支持可选开启实时监控", diff --git a/plugins/cloudassistant/__init__.py b/plugins/cloudassistant/__init__.py index 4ef6d14..611186e 100644 --- a/plugins/cloudassistant/__init__.py +++ b/plugins/cloudassistant/__init__.py @@ -113,12 +113,12 @@ class CloudAssistant(_PluginBase): "dest_path": "/mnt/media/movies", "mount_path": "/mnt/cloud/115/media/movies", "return_path": "/mnt/softlink/movies", - "delete_local": "false", - "local_preserve_hierarchy": 0, + "delete_dest": "false", + "dest_preserve_hierarchy": 0, "delete_history": "false", - "delete_source": "false", + "delete_src": "false", "src_paths": "/mnt/media/movies, /mnt/media/series", - "source_preserve_hierarchy": 0, + "src_preserve_hierarchy": 0, "just_media": "true", "overwrite": "false", "upload_cloud": "true" @@ -419,14 +419,14 @@ class CloudAssistant(_PluginBase): mount_path = monitor_dir.get("mount_path") # cd2_path = monitor_dir.get("cd2_path") return_path = monitor_dir.get("return_path") - delete_local = monitor_dir.get("delete_local") or "false" - delete_source = monitor_dir.get("delete_source") or "false" + delete_dest = monitor_dir.get("delete_dest") or "false" + delete_src = monitor_dir.get("delete_src") or "false" delete_history = monitor_dir.get("delete_history") or "false" overwrite = monitor_dir.get("overwrite") or "false" upload_cloud = monitor_dir.get("upload_cloud") or "true" - local_preserve_hierarchy = monitor_dir.get("local_preserve_hierarchy") or 0 + dest_preserve_hierarchy = monitor_dir.get("dest_preserve_hierarchy") or 0 src_paths = monitor_dir.get("src_paths") or "" - source_preserve_hierarchy = monitor_dir.get("source_preserve_hierarchy") or 0 + src_preserve_hierarchy = monitor_dir.get("src_preserve_hierarchy") or 0 # 1、转移到云盘挂载路径 上传到cd2 # 挂载的路径 @@ -503,7 +503,7 @@ class CloudAssistant(_PluginBase): "file_path": str(file_path), "target_cloud_file": mount_file, "target_soft_file": target_return_file, - "delete_local": delete_local, + "delete_dest": delete_dest, "delete_history": delete_history, "time": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) }) @@ -511,11 +511,11 @@ class CloudAssistant(_PluginBase): self.save_data(key="history", value=history) # 移动模式删除空目录 - if str(delete_local) == "true": - self.__delete_local_file(file_path, mon_path, local_preserve_hierarchy) + if str(delete_dest) == "true": + self.__delete_dest_file(file_path, mon_path, dest_preserve_hierarchy) # 是否删除源文件 - if str(delete_source) == "true" and transferhis: - self.__delete_source_file(transferhis, src_paths, source_preserve_hierarchy) + if str(delete_src) == "true" and transferhis: + self.__delete_src_file(transferhis, src_paths, src_preserve_hierarchy) # 发送消息汇总 if self._notify and transferhis: self.__msg_handler(transferhis) @@ -541,7 +541,7 @@ class CloudAssistant(_PluginBase): self.downloadhis.delete_downloadfile(downloadfile.id) logger.info(f"删除下载文件记录:{downloadfile.id} {transferhis.download_hash}") - def __delete_local_file(self, file_path: Path, mon_path: str, local_preserve_hierarchy: int): + def __delete_dest_file(self, file_path: Path, mon_path: str, dest_preserve_hierarchy: int): """ 删除监控文件 """ @@ -551,7 +551,7 @@ class CloudAssistant(_PluginBase): # 保留层级 mon_path_depth = len(Path(mon_path).parts) - retain_depth = mon_path_depth + int(local_preserve_hierarchy) + retain_depth = mon_path_depth + int(dest_preserve_hierarchy) for file_dir in file_path.parents: if len(file_dir.parts) <= retain_depth: @@ -562,7 +562,7 @@ class CloudAssistant(_PluginBase): logger.warn(f"删除监控空目录:{file_dir}") shutil.rmtree(file_dir, ignore_errors=True) - def __delete_source_file(self, transferhis, src_paths, source_preserve_hierarchy): + def __delete_src_file(self, transferhis, src_paths, src_preserve_hierarchy): """ 删除源文件 """ @@ -596,7 +596,7 @@ class CloudAssistant(_PluginBase): if source_path: # 保留层级 source_path_depth = len(Path(source_path).parts) - retain_depth = source_path_depth + int(source_preserve_hierarchy) + retain_depth = source_path_depth + int(src_preserve_hierarchy) for file_dir in Path(transferhis.src).parents: if len(file_dir.parts) <= retain_depth: @@ -1528,7 +1528,7 @@ class CloudAssistant(_PluginBase): }, { 'component': 'td', - 'text': history.get("delete_local") + 'text': history.get("delete_dest") }, { 'component': 'td',