mirror of
https://github.com/thsrite/MoviePilot-Plugins.git
synced 2026-03-27 10:05:57 +00:00
fix 添加异常处理,解决cd2上本地目录获取存储空间失败的问题
This commit is contained in:
@@ -42,7 +42,7 @@ MoviePilot三方插件市场:https://github.com/thsrite/MoviePilot-Plugins/
|
||||
- 目录监控(统一入库消息增强版) v1.0
|
||||
- Sql执行器 v1.3
|
||||
- 命令执行器 v1.2
|
||||
- [CloudDrive2助手v1.8.2](docs%2FCd2Assistant.md)
|
||||
- [CloudDrive2助手v1.8.3](docs%2FCd2Assistant.md)
|
||||
- 软连接重定向 v1.1
|
||||
- 云盘同步删除 v1.5.3
|
||||
- 媒体库重复媒体检测 v1.9
|
||||
|
||||
@@ -590,11 +590,12 @@
|
||||
"name": "CloudDrive2助手",
|
||||
"description": "监控上传任务,检测是否有异常,发送通知。",
|
||||
"labels": "云盘",
|
||||
"version": "1.8.2",
|
||||
"version": "1.8.3",
|
||||
"icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/clouddrive.png",
|
||||
"author": "thsrite",
|
||||
"level": 2,
|
||||
"history": {
|
||||
"v1.8.3": "添加异常处理,解决cd2上本地目录获取存储空间失败的问题",
|
||||
"v1.8.2": "插件页面密码类型设置为pasword",
|
||||
"v1.8.1": "云下载支持自定义路径 /cd /cd2路径 磁链",
|
||||
"v1.8": "修复插件依赖安装问题",
|
||||
|
||||
@@ -2,12 +2,14 @@ import re
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import pytz
|
||||
|
||||
try:
|
||||
from clouddrive import CloudDriveClient, Client
|
||||
from clouddrive.proto import CloudDrive_pb2
|
||||
except ImportError:
|
||||
from sys import executable
|
||||
from subprocess import run
|
||||
|
||||
run([executable, "-m", "pip", "install", "-U", "clouddrive"], check=True)
|
||||
from app import schemas
|
||||
from app.core.config import settings
|
||||
@@ -30,7 +32,7 @@ class Cd2Assistant(_PluginBase):
|
||||
# 插件图标
|
||||
plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/clouddrive.png"
|
||||
# 插件版本
|
||||
plugin_version = "1.8.2"
|
||||
plugin_version = "1.8.3"
|
||||
# 插件作者
|
||||
plugin_author = "thsrite"
|
||||
# 作者主页
|
||||
@@ -234,13 +236,16 @@ class Cd2Assistant(_PluginBase):
|
||||
|
||||
_space_info = "\n"
|
||||
for f in fs.listdir():
|
||||
if f and f not in self._black_dir.split(","):
|
||||
space_info = self._cd2_client.GetSpaceInfo(CloudDrive_pb2.FileRequest(path=f))
|
||||
space_info = self.__str_to_dict(space_info)
|
||||
total = self.__convert_bytes(space_info.get("totalSpace"))
|
||||
used = self.__convert_bytes(space_info.get("usedSpace"))
|
||||
free = self.__convert_bytes(space_info.get("freeSpace"))
|
||||
_space_info += f"{f}:{used}/{total}\n"
|
||||
try:
|
||||
if f and f not in self._black_dir.split(","):
|
||||
space_info = self._cd2_client.GetSpaceInfo(CloudDrive_pb2.FileRequest(path=f))
|
||||
space_info = self.__str_to_dict(space_info)
|
||||
total = self.__convert_bytes(space_info.get("totalSpace"))
|
||||
used = self.__convert_bytes(space_info.get("usedSpace"))
|
||||
free = self.__convert_bytes(space_info.get("freeSpace"))
|
||||
_space_info += f"{f}:{used}/{total}\n"
|
||||
except Exception:
|
||||
logger.error(f"获取云盘 {f} 空间信息失败")
|
||||
|
||||
return _space_info
|
||||
|
||||
@@ -675,7 +680,8 @@ class Cd2Assistant(_PluginBase):
|
||||
'component': 'VTextField',
|
||||
'props': {
|
||||
'model': 'black_dir',
|
||||
'label': 'cd2黑名单目录'
|
||||
'label': 'cd2黑名单目录',
|
||||
'placeholder': 'cd2上添加的本地目录'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user