This commit is contained in:
jxxghp
2023-09-25 07:12:36 +08:00
parent a7b51d9fcc
commit b3c0dc813b

View File

@ -536,16 +536,14 @@ class FileTransferModule(_ModuleBase):
@staticmethod @staticmethod
def get_library_path(path: Path): def get_library_path(path: Path):
""" """
根据目录查询其所在的媒体库目录 根据目录查询其所在的媒体库目录,查询不到的返回输入目录
""" """
if not path: if not path:
return None return None
if not settings.LIBRARY_PATHS: if not settings.LIBRARY_PATHS:
return None return path
# 目的路径,多路径以,分隔 # 目的路径,多路径以,分隔
dest_paths = settings.LIBRARY_PATHS dest_paths = settings.LIBRARY_PATHS
if len(dest_paths) == 1:
return dest_paths[0]
for libpath in dest_paths: for libpath in dest_paths:
try: try:
if path.is_relative_to(libpath): if path.is_relative_to(libpath):
@ -553,7 +551,7 @@ class FileTransferModule(_ModuleBase):
except Exception as e: except Exception as e:
logger.debug(f"计算媒体库路径时出错:{e}") logger.debug(f"计算媒体库路径时出错:{e}")
continue continue
return None return path
@staticmethod @staticmethod
def get_target_path(in_path: Path = None) -> Optional[Path]: def get_target_path(in_path: Path = None) -> Optional[Path]: