fix 重命名Bug
This commit is contained in:
parent
b3281b3b1e
commit
a2d2ac7c73
@ -88,9 +88,9 @@ class MetaAnime(MetaBase):
|
||||
self.begin_season = int(begin_season)
|
||||
if end_season and int(end_season) != self.begin_season:
|
||||
self.end_season = int(end_season)
|
||||
self.total_seasons = (self.end_season - self.begin_season) + 1
|
||||
self.total_season = (self.end_season - self.begin_season) + 1
|
||||
else:
|
||||
self.total_seasons = 1
|
||||
self.total_season = 1
|
||||
self.type = MediaType.TV
|
||||
# 集号
|
||||
episode_number = anitopy_info.get("episode_number")
|
||||
|
@ -30,7 +30,7 @@ class MetaBase(object):
|
||||
# 年份
|
||||
year: Optional[str] = None
|
||||
# 总季数
|
||||
total_seasons: int = 0
|
||||
total_season: int = 0
|
||||
# 识别的开始季 数字
|
||||
begin_season: Optional[int] = None
|
||||
# 识别的结束季 数字
|
||||
@ -115,13 +115,13 @@ class MetaBase(object):
|
||||
return
|
||||
if self.begin_season is None and isinstance(begin_season, int):
|
||||
self.begin_season = begin_season
|
||||
self.total_seasons = 1
|
||||
self.total_season = 1
|
||||
if self.begin_season is not None \
|
||||
and self.end_season is None \
|
||||
and isinstance(end_season, int) \
|
||||
and end_season != self.begin_season:
|
||||
self.end_season = end_season
|
||||
self.total_seasons = (self.end_season - self.begin_season) + 1
|
||||
self.total_season = (self.end_season - self.begin_season) + 1
|
||||
self.type = MediaType.TV
|
||||
self._subtitle_flag = True
|
||||
# 第x集
|
||||
@ -179,12 +179,12 @@ class MetaBase(object):
|
||||
season_all = season_all_str.group(2)
|
||||
if season_all and self.begin_season is None and self.begin_episode is None:
|
||||
try:
|
||||
self.total_seasons = int(cn2an.cn2an(season_all.strip(), mode='smart'))
|
||||
self.total_season = int(cn2an.cn2an(season_all.strip(), mode='smart'))
|
||||
except Exception as err:
|
||||
print(str(err))
|
||||
return
|
||||
self.begin_season = 1
|
||||
self.end_season = self.total_seasons
|
||||
self.end_season = self.total_season
|
||||
self.type = MediaType.TV
|
||||
self._subtitle_flag = True
|
||||
|
||||
@ -466,8 +466,10 @@ class MetaBase(object):
|
||||
if not self.end_season:
|
||||
self.end_season = meta.end_season
|
||||
# 总季数
|
||||
if self.begin_season:
|
||||
self.total_seasons = meta.total_seasons
|
||||
if self.begin_season and self.end_season:
|
||||
self.total_season = (self.end_season - self.begin_season) + 1
|
||||
elif self.begin_season:
|
||||
self.total_season = 1
|
||||
# 开始集
|
||||
if not self.begin_episode:
|
||||
self.begin_episode = meta.begin_episode
|
||||
@ -475,8 +477,10 @@ class MetaBase(object):
|
||||
if not self.end_episode:
|
||||
self.end_episode = meta.end_episode
|
||||
# 总集数
|
||||
if not self.total_episode:
|
||||
self.total_episode = meta.total_episode
|
||||
if self.begin_episode and self.end_episode:
|
||||
self.total_episode = (self.end_episode - self.begin_episode) + 1
|
||||
elif self.begin_episode:
|
||||
self.total_episode = 1
|
||||
# 版本
|
||||
if not self.resource_type:
|
||||
self.resource_type = meta.resource_type
|
||||
|
@ -347,14 +347,14 @@ class MetaVideo(MetaBase):
|
||||
se = int(se)
|
||||
if self.begin_season is None:
|
||||
self.begin_season = se
|
||||
self.total_seasons = 1
|
||||
self.total_season = 1
|
||||
else:
|
||||
if se > self.begin_season:
|
||||
self.end_season = se
|
||||
self.total_seasons = (self.end_season - self.begin_season) + 1
|
||||
if self.isfile and self.total_seasons > 1:
|
||||
self.total_season = (self.end_season - self.begin_season) + 1
|
||||
if self.isfile and self.total_season > 1:
|
||||
self.end_season = None
|
||||
self.total_seasons = 1
|
||||
self.total_season = 1
|
||||
elif token.isdigit():
|
||||
try:
|
||||
int(token)
|
||||
@ -364,7 +364,7 @@ class MetaVideo(MetaBase):
|
||||
and self.begin_season is None \
|
||||
and len(token) < 3:
|
||||
self.begin_season = int(token)
|
||||
self.total_seasons = 1
|
||||
self.total_season = 1
|
||||
self._last_token_type = "season"
|
||||
self._stop_name_flag = True
|
||||
self._continue_flag = False
|
||||
|
@ -426,11 +426,17 @@ class FileTransferModule(_ModuleBase):
|
||||
file_meta = MetaInfo(transfer_file.stem)
|
||||
# 合并元数据
|
||||
file_meta.merge(meta)
|
||||
# 结束季为空
|
||||
|
||||
# 文件结束季为空
|
||||
file_meta.end_season = None
|
||||
# 总季数为1
|
||||
if file_meta.begin_season:
|
||||
file_meta.total_seasons = 1
|
||||
# 文件总季数为1
|
||||
if file_meta.total_season:
|
||||
file_meta.total_season = 1
|
||||
# 文件不可能有多集
|
||||
if file_meta.total_episode > 2:
|
||||
file_meta.total_episode = 1
|
||||
file_meta.end_episode = None
|
||||
|
||||
# 目的文件名
|
||||
new_file = self.get_rename_path(
|
||||
path=target_dir,
|
||||
|
@ -186,11 +186,6 @@ class DirMonitor(_PluginBase):
|
||||
file_meta = MetaInfo(title=file_path.stem)
|
||||
# 合并元数据
|
||||
file_meta.merge(meta)
|
||||
# 结束季为空
|
||||
file_meta.end_season = None
|
||||
# 总季数为1
|
||||
if file_meta.begin_season:
|
||||
file_meta.total_seasons = 1
|
||||
|
||||
if not file_meta.name:
|
||||
logger.warn(f"{file_path.name} 无法识别有效信息")
|
||||
|
@ -26,7 +26,7 @@ class MetaInfo(BaseModel):
|
||||
# 年份
|
||||
year: Optional[str] = None
|
||||
# 总季数
|
||||
total_seasons: Optional[int] = 0
|
||||
total_season: Optional[int] = 0
|
||||
# 识别的开始季 数字
|
||||
begin_season: Optional[int] = None
|
||||
# 识别的结束季 数字
|
||||
|
Loading…
x
Reference in New Issue
Block a user