fix #2165
This commit is contained in:
@ -70,10 +70,6 @@ def manual_transfer(path: str = None,
|
|||||||
if history.dest and str(history.dest) != "None":
|
if history.dest and str(history.dest) != "None":
|
||||||
# 删除旧的已整理文件
|
# 删除旧的已整理文件
|
||||||
transfer.delete_files(Path(history.dest))
|
transfer.delete_files(Path(history.dest))
|
||||||
if not target:
|
|
||||||
target = transfer.get_root_path(path=history.dest,
|
|
||||||
type_name=history.type,
|
|
||||||
category=history.category)
|
|
||||||
elif path:
|
elif path:
|
||||||
in_path = Path(path)
|
in_path = Path(path)
|
||||||
else:
|
else:
|
||||||
|
@ -490,24 +490,6 @@ class TransferChain(ChainBase):
|
|||||||
text=errmsg, userid=userid))
|
text=errmsg, userid=userid))
|
||||||
return
|
return
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_root_path(path: str, type_name: str, category: str) -> Optional[Path]:
|
|
||||||
"""
|
|
||||||
计算媒体库目录的根路径
|
|
||||||
"""
|
|
||||||
if not path or path == "None":
|
|
||||||
return None
|
|
||||||
index = -2
|
|
||||||
if type_name != '电影':
|
|
||||||
index = -3
|
|
||||||
if category:
|
|
||||||
index -= 1
|
|
||||||
if '/' in path:
|
|
||||||
retpath = '/'.join(path.split('/')[:index])
|
|
||||||
else:
|
|
||||||
retpath = '\\'.join(path.split('\\')[:index])
|
|
||||||
return Path(retpath)
|
|
||||||
|
|
||||||
def re_transfer(self, logid: int, mtype: MediaType = None,
|
def re_transfer(self, logid: int, mtype: MediaType = None,
|
||||||
mediaid: str = None) -> Tuple[bool, str]:
|
mediaid: str = None) -> Tuple[bool, str]:
|
||||||
"""
|
"""
|
||||||
@ -525,7 +507,6 @@ class TransferChain(ChainBase):
|
|||||||
src_path = Path(history.src)
|
src_path = Path(history.src)
|
||||||
if not src_path.exists():
|
if not src_path.exists():
|
||||||
return False, f"源目录不存在:{src_path}"
|
return False, f"源目录不存在:{src_path}"
|
||||||
dest_path = self.get_root_path(path=history.dest, type_name=history.type, category=history.category)
|
|
||||||
# 查询媒体信息
|
# 查询媒体信息
|
||||||
if mtype and mediaid:
|
if mtype and mediaid:
|
||||||
mediainfo = self.recognize_media(mtype=mtype, tmdbid=int(mediaid) if str(mediaid).isdigit() else None,
|
mediainfo = self.recognize_media(mtype=mtype, tmdbid=int(mediaid) if str(mediaid).isdigit() else None,
|
||||||
@ -548,7 +529,6 @@ class TransferChain(ChainBase):
|
|||||||
state, errmsg = self.do_transfer(path=src_path,
|
state, errmsg = self.do_transfer(path=src_path,
|
||||||
mediainfo=mediainfo,
|
mediainfo=mediainfo,
|
||||||
download_hash=history.download_hash,
|
download_hash=history.download_hash,
|
||||||
target=dest_path,
|
|
||||||
force=True)
|
force=True)
|
||||||
if not state:
|
if not state:
|
||||||
return False, errmsg
|
return False, errmsg
|
||||||
|
Reference in New Issue
Block a user