This commit is contained in:
jxxghp
2023-10-26 16:45:09 +08:00
parent a85d55f3a8
commit 935ad73d32
2 changed files with 20 additions and 1 deletions

View File

@ -13,6 +13,7 @@ from app.log import logger
from app.modules import _ModuleBase
from app.schemas import TransferInfo, ExistMediaInfo, TmdbEpisode
from app.schemas.types import MediaType
from app.utils.string import StringUtils
from app.utils.system import SystemUtils
lock = Lock()
@ -53,6 +54,8 @@ class FileTransferModule(_ModuleBase):
return TransferInfo(success=False,
path=path,
message="未找到媒体库目录")
else:
logger.info(f"获取转移目标路径:{target}")
# 转移
return self.transfer_media(in_path=path,
in_meta=meta,
@ -629,7 +632,8 @@ class FileTransferModule(_ModuleBase):
if in_path:
for path in dest_paths:
try:
relative = in_path.relative_to(path).as_posix()
# 计算in_path和path的公共字符串长度
relative = StringUtils.find_common_prefix(str(in_path), str(path))
if len(relative) > max_length:
max_length = len(relative)
target_path = path