Skip to content

Commit

Permalink
fix 手动整理时剧集处理
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxghp committed Sep 3, 2023
1 parent d043dbd commit 5f88fe8
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions app/chain/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def process(self) -> bool:
def do_transfer(self, path: Path, meta: MetaBase = None,
mediainfo: MediaInfo = None, download_hash: str = None,
target: Path = None, transfer_type: str = None,
epformat: EpisodeFormat = None, min_filesize: int = 0) -> Tuple[bool, str]:
season: int = None, epformat: EpisodeFormat = None,
min_filesize: int = 0) -> Tuple[bool, str]:
"""
执行一个复杂目录的转移操作
:param path: 待转移目录或文件
Expand All @@ -93,6 +94,7 @@ def do_transfer(self, path: Path, meta: MetaBase = None,
:param download_hash: 下载记录hash
:param target: 目标路径
:param transfer_type: 转移类型
:param season: 季
:param epformat: 剧集格式
:param min_filesize: 最小文件大小(MB)
返回:成功标识,错误信息
Expand Down Expand Up @@ -190,6 +192,10 @@ def do_transfer(self, path: Path, meta: MetaBase = None,
else:
file_meta = meta

# 合并季
if season:
file_meta.begin_season = season

if not file_meta:
logger.error(f"{file_path} 无法识别有效信息")
err_msgs.append(f"{file_path} 无法识别有效信息")
Expand Down Expand Up @@ -449,10 +455,6 @@ def re_transfer(self, logid: int, mtype: MediaType, tmdbid: int) -> Tuple[bool,
src_path = Path(history.src)
if not src_path.exists():
return False, f"源目录不存在:{src_path}"
# 识别元数据
meta = MetaInfo(title=src_path.stem)
if not meta.name:
return False, f"未识别到元数据,标题:{src_path.stem}"
# 查询媒体信息
mediainfo = self.recognize_media(mtype=mtype, tmdbid=tmdbid)
if not mediainfo:
Expand All @@ -464,7 +466,6 @@ def re_transfer(self, logid: int, mtype: MediaType, tmdbid: int) -> Tuple[bool,

# 转移
state, errmsg = self.do_transfer(path=src_path,
meta=meta,
mediainfo=mediainfo,
download_hash=history.download_hash)
if not state:
Expand Down Expand Up @@ -502,12 +503,6 @@ def manual_transfer(self, in_path: Path,

if tmdbid:
# 有输入TMDBID时单个识别
meta = MetaInfo(in_path.stem)
# 整合数据
if mtype:
meta.type = mtype
if season is not None:
meta.begin_season = season
# 识别媒体信息
mediainfo: MediaInfo = self.mediachain.recognize_media(tmdbid=tmdbid, mtype=mtype)
if not mediainfo:
Expand All @@ -520,9 +515,9 @@ def manual_transfer(self, in_path: Path,
# 开始转移
state, errmsg = self.do_transfer(
path=in_path,
meta=meta,
mediainfo=mediainfo,
target=target,
season=season,
epformat=epformat,
min_filesize=min_filesize
)
Expand All @@ -537,6 +532,7 @@ def manual_transfer(self, in_path: Path,
state, errmsg = self.do_transfer(path=in_path,
target=target,
transfer_type=transfer_type,
season=season,
epformat=epformat,
min_filesize=min_filesize)
return state, errmsg
Expand Down

0 comments on commit 5f88fe8

Please sign in to comment.