mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-02-13 07:25:53 +08:00
fix transfer
This commit is contained in:
@@ -128,9 +128,9 @@ class TransferHistoryOper(DbOper):
|
||||
src=fileitem.path,
|
||||
src_storage=fileitem.storage,
|
||||
src_fileitem=json.dumps(fileitem.dict()),
|
||||
dest=transferinfo.target_item.path,
|
||||
dest=transferinfo.target_item.path if transferinfo.target_item else None,
|
||||
dest_storage=transferinfo.target_item.storage,
|
||||
dest_fileitem=json.dumps(transferinfo.target_item.dict()),
|
||||
dest_fileitem=json.dumps(transferinfo.target_item.dict()) if transferinfo.target_item else None,
|
||||
mode=mode,
|
||||
type=mediainfo.type.value,
|
||||
category=mediainfo.category,
|
||||
|
||||
@@ -387,6 +387,9 @@ class FileManagerModule(_ModuleBase):
|
||||
# 加锁
|
||||
with lock:
|
||||
if fileitem.storage == "local" and target_storage == "local":
|
||||
# 创建目录
|
||||
if not target_file.parent.exists():
|
||||
target_file.parent.mkdir(parents=True)
|
||||
# 本地到本地
|
||||
if transfer_type == "copy":
|
||||
state = source_oper.copy(fileitem, target_file)
|
||||
@@ -444,6 +447,9 @@ class FileManagerModule(_ModuleBase):
|
||||
# 下载
|
||||
tmp_file = source_oper.download(fileitem)
|
||||
if tmp_file:
|
||||
# 创建目录
|
||||
if not target_file.parent.exists():
|
||||
target_file.parent.mkdir(parents=True)
|
||||
# 将tmp_file移动后target_file
|
||||
tmp_file.rename(target_file)
|
||||
return __get_targetitem(target_file), ""
|
||||
@@ -453,6 +459,8 @@ class FileManagerModule(_ModuleBase):
|
||||
# 下载
|
||||
tmp_file = source_oper.download(fileitem)
|
||||
if tmp_file:
|
||||
if not target_file.parent.exists():
|
||||
target_file.parent.mkdir(parents=True)
|
||||
# 将tmp_file移动后target_file
|
||||
tmp_file.rename(target_file)
|
||||
# 删除源文件
|
||||
|
||||
Reference in New Issue
Block a user