mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-07 00:16:57 +08:00
refactor: isolate transfer file item construction
This commit is contained in:
+14
-9
@@ -1416,15 +1416,7 @@ class TransferChain(FileFilterMixin, ScrapeBatchMixin, EpisodeFormatMixin, Histo
|
|||||||
|
|
||||||
# 执行异步整理,匹配源目录
|
# 执行异步整理,匹配源目录
|
||||||
self.do_transfer(
|
self.do_transfer(
|
||||||
fileitem=FileItem(
|
fileitem=self._build_transfer_fileitem(torrent),
|
||||||
storage="local",
|
|
||||||
path=file_path.as_posix()
|
|
||||||
+ ("/" if file_path.is_dir() else ""),
|
|
||||||
type="dir" if not file_path.is_file() else "file",
|
|
||||||
name=file_path.name,
|
|
||||||
size=file_path.stat().st_size,
|
|
||||||
extension=file_path.suffix.lstrip("."),
|
|
||||||
),
|
|
||||||
mediainfo=mediainfo,
|
mediainfo=mediainfo,
|
||||||
mtype=mtype,
|
mtype=mtype,
|
||||||
downloader=torrent.downloader,
|
downloader=torrent.downloader,
|
||||||
@@ -1443,6 +1435,19 @@ class TransferChain(FileFilterMixin, ScrapeBatchMixin, EpisodeFormatMixin, Histo
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _build_transfer_fileitem(torrent: TorrentInfo) -> FileItem:
|
||||||
|
"""把下载器任务路径转换为整理链使用的本地文件项。"""
|
||||||
|
file_path = torrent.path
|
||||||
|
return FileItem(
|
||||||
|
storage="local",
|
||||||
|
path=file_path.as_posix() + ("/" if file_path.is_dir() else ""),
|
||||||
|
type="dir" if not file_path.is_file() else "file",
|
||||||
|
name=file_path.name,
|
||||||
|
size=file_path.stat().st_size,
|
||||||
|
extension=file_path.suffix.lstrip("."),
|
||||||
|
)
|
||||||
|
|
||||||
def __get_trans_fileitems(
|
def __get_trans_fileitems(
|
||||||
self,
|
self,
|
||||||
fileitem: FileItem,
|
fileitem: FileItem,
|
||||||
|
|||||||
Reference in New Issue
Block a user