云下载支持自定义路径 /cd /cd2路径 磁链

This commit is contained in:
thsrite
2024-08-07 10:24:58 +08:00
parent 7825f999af
commit a3a3400562
3 changed files with 14 additions and 7 deletions

View File

@@ -42,7 +42,7 @@ MoviePilot三方插件市场https://github.com/thsrite/MoviePilot-Plugins/
- 目录监控(统一入库消息增强版) v1.0
- Sql执行器 v1.3
- 命令执行器 v1.2
- [CloudDrive2助手v1.8](docs%2FCd2Assistant.md)
- [CloudDrive2助手v1.8.1](docs%2FCd2Assistant.md)
- 软连接重定向 v1.1
- 云盘同步删除 v1.5.2
- 媒体库重复媒体检测 v1.9

View File

@@ -587,11 +587,12 @@
"name": "CloudDrive2助手",
"description": "监控上传任务,检测是否有异常,发送通知。",
"labels": "云盘",
"version": "1.8",
"version": "1.8.1",
"icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/clouddrive.png",
"author": "thsrite",
"level": 2,
"history": {
"v1.8.1": "云下载支持自定义路径 /cd /cd2路径 磁链",
"v1.8": "修复插件依赖安装问题",
"v1.7": "增加HomePage自定义API详见插件说明",
"v1.6": "支持交互命令云下载",

View File

@@ -30,7 +30,7 @@ class Cd2Assistant(_PluginBase):
# 插件图标
plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/clouddrive.png"
# 插件版本
plugin_version = "1.8"
plugin_version = "1.8.1"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -257,9 +257,14 @@ class Cd2Assistant(_PluginBase):
if not args:
logger.error(f"缺少参数:{event_data}")
return
args = args.replace(" ", "\n")
if not self._cloud_path:
# 判断有无指定路径
args = args.replace(" ", "\n")
_cloud_path = self._cloud_path.strip()
if args.split("\n")[0].startswith("/"):
_cloud_path = str(args.split("\n")[0])
args = args.replace(f"{_cloud_path}\n", "")
if not _cloud_path:
logger.error("请先设置云盘路径")
if event.event_data.get("user"):
self.post_message(channel=event.event_data.get("channel"),
@@ -267,14 +272,15 @@ class Cd2Assistant(_PluginBase):
userid=event.event_data.get("user"))
return
logger.info(f"获取到离线云盘路径:{_cloud_path}")
logger.info(f"开始离线下载:{args}")
result = self._client.AddOfflineFiles(
CloudDrive_pb2.AddOfflineFileRequest(urls=args, toFolder=self._cloud_path))
CloudDrive_pb2.AddOfflineFileRequest(urls=args, toFolder=_cloud_path))
if result and result.success:
logger.info(f"离线下载成功")
if event.event_data.get("user"):
self.post_message(channel=event.event_data.get("channel"),
title=f"离线下载成功!",
title=f"{_cloud_path} 离线下载成功!",
userid=event.event_data.get("user"))
else:
errorMessage = None