fix rclone

This commit is contained in:
jxxghp
2024-07-02 20:32:32 +08:00
parent b37e50480a
commit 0da2bd6468
3 changed files with 218 additions and 29 deletions

View File

@@ -56,31 +56,32 @@ class FileManagerModule(_ModuleBase):
if not dirs:
return False, "未设置任何目录"
for d in dirs:
# 下载目录
download_path = d.download_path
if not download_path:
return False, f"{d.name} 的下载目录未设置"
if d.storage == "local" and not Path(download_path).exists():
return False, f"{d.name} 的下载目录 {download_path} 不存在"
# 媒体库目录
library_path = d.library_path
if not library_path:
return False, f"{d.name} 的媒体库目录未设置"
if d.library_storage == "local" and not Path(library_path).exists():
return False, f"{d.name} 的媒体库目录 {library_path} 不存在"
# 检查软硬链接
if d.transfer_type in ["link", "softlink"] \
and (d.storage != "local" or d.library_storage != "local"):
return False, f"{d.name} 不是本地存储,不支持软硬链接"
# 检查硬链接
# 硬链接
if d.transfer_type == "link" \
and d.storage == "local" \
and d.library_storage == "local" \
and not SystemUtils.is_same_disk(Path(download_path), Path(library_path)):
return False, f"{d.name} 的下载目录 {download_path} 与媒体库目录 {library_path} 不在同一磁盘,无法硬链接"
# 检查网盘
if d.storage != "local":
storage_oper = self.__get_storage_oper(d.storage)
if not storage_oper:
return False, f"{d.name} 的存储类型 {d.storage} 不支持"
if not storage_oper.check():
return False, f"{d.name} 的存储测试不通过"
# 存储
storage_oper = self.__get_storage_oper(d.storage)
if not storage_oper:
return False, f"{d.name} 的存储类型 {d.storage} 不支持"
if not storage_oper.check():
return False, f"{d.name} 的存储测试不通过"
if d.transfer_type and d.transfer_type not in storage_oper.support_transtype():
return False, f"{d.name} 的存储不支持 {d.transfer_type} 整理方式"
return True, ""