Skip to content

Commit 5f88fe8

Browse files
committed
fix 手动整理时剧集处理
1 parent d043dbd commit 5f88fe8

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

app/chain/transfer.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ def process(self) -> bool:
8484
def do_transfer(self, path: Path, meta: MetaBase = None,
8585
mediainfo: MediaInfo = None, download_hash: str = None,
8686
target: Path = None, transfer_type: str = None,
87-
epformat: EpisodeFormat = None, min_filesize: int = 0) -> Tuple[bool, str]:
87+
season: int = None, epformat: EpisodeFormat = None,
88+
min_filesize: int = 0) -> Tuple[bool, str]:
8889
"""
8990
执行一个复杂目录的转移操作
9091
:param path: 待转移目录或文件
@@ -93,6 +94,7 @@ def do_transfer(self, path: Path, meta: MetaBase = None,
9394
:param download_hash: 下载记录hash
9495
:param target: 目标路径
9596
:param transfer_type: 转移类型
97+
:param season: 季
9698
:param epformat: 剧集格式
9799
:param min_filesize: 最小文件大小(MB)
98100
返回:成功标识,错误信息
@@ -190,6 +192,10 @@ def do_transfer(self, path: Path, meta: MetaBase = None,
190192
else:
191193
file_meta = meta
192194

195+
# 合并季
196+
if season:
197+
file_meta.begin_season = season
198+
193199
if not file_meta:
194200
logger.error(f"{file_path} 无法识别有效信息")
195201
err_msgs.append(f"{file_path} 无法识别有效信息")
@@ -449,10 +455,6 @@ def re_transfer(self, logid: int, mtype: MediaType, tmdbid: int) -> Tuple[bool,
449455
src_path = Path(history.src)
450456
if not src_path.exists():
451457
return False, f"源目录不存在:{src_path}"
452-
# 识别元数据
453-
meta = MetaInfo(title=src_path.stem)
454-
if not meta.name:
455-
return False, f"未识别到元数据,标题:{src_path.stem}"
456458
# 查询媒体信息
457459
mediainfo = self.recognize_media(mtype=mtype, tmdbid=tmdbid)
458460
if not mediainfo:
@@ -464,7 +466,6 @@ def re_transfer(self, logid: int, mtype: MediaType, tmdbid: int) -> Tuple[bool,
464466

465467
# 转移
466468
state, errmsg = self.do_transfer(path=src_path,
467-
meta=meta,
468469
mediainfo=mediainfo,
469470
download_hash=history.download_hash)
470471
if not state:
@@ -502,12 +503,6 @@ def manual_transfer(self, in_path: Path,
502503

503504
if tmdbid:
504505
# 有输入TMDBID时单个识别
505-
meta = MetaInfo(in_path.stem)
506-
# 整合数据
507-
if mtype:
508-
meta.type = mtype
509-
if season is not None:
510-
meta.begin_season = season
511506
# 识别媒体信息
512507
mediainfo: MediaInfo = self.mediachain.recognize_media(tmdbid=tmdbid, mtype=mtype)
513508
if not mediainfo:
@@ -520,9 +515,9 @@ def manual_transfer(self, in_path: Path,
520515
# 开始转移
521516
state, errmsg = self.do_transfer(
522517
path=in_path,
523-
meta=meta,
524518
mediainfo=mediainfo,
525519
target=target,
520+
season=season,
526521
epformat=epformat,
527522
min_filesize=min_filesize
528523
)
@@ -537,6 +532,7 @@ def manual_transfer(self, in_path: Path,
537532
state, errmsg = self.do_transfer(path=in_path,
538533
target=target,
539534
transfer_type=transfer_type,
535+
season=season,
540536
epformat=epformat,
541537
min_filesize=min_filesize)
542538
return state, errmsg

0 commit comments

Comments
 (0)