mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-08 17:08:35 +08:00
fix #3135
This commit is contained in:
+21
-17
@@ -377,6 +377,11 @@ class MediaChain(ChainBase, metaclass=Singleton):
|
|||||||
if mediainfo.type == MediaType.MOVIE:
|
if mediainfo.type == MediaType.MOVIE:
|
||||||
# 电影
|
# 电影
|
||||||
if fileitem.type == "file":
|
if fileitem.type == "file":
|
||||||
|
# 是否已存在
|
||||||
|
nfo_path = filepath.with_suffix(".nfo")
|
||||||
|
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage, path=nfo_path):
|
||||||
|
logger.debug(f"已存在nfo文件:{nfo_path}")
|
||||||
|
return
|
||||||
# 电影文件
|
# 电影文件
|
||||||
logger.info(f"正在生成电影nfo:{mediainfo.title_year} - {filepath.name}")
|
logger.info(f"正在生成电影nfo:{mediainfo.title_year} - {filepath.name}")
|
||||||
movie_nfo = self.metadata_nfo(meta=meta, mediainfo=mediainfo)
|
movie_nfo = self.metadata_nfo(meta=meta, mediainfo=mediainfo)
|
||||||
@@ -384,10 +389,6 @@ class MediaChain(ChainBase, metaclass=Singleton):
|
|||||||
logger.warn(f"{filepath.name} nfo文件生成失败!")
|
logger.warn(f"{filepath.name} nfo文件生成失败!")
|
||||||
return
|
return
|
||||||
# 保存或上传nfo文件到上级目录
|
# 保存或上传nfo文件到上级目录
|
||||||
nfo_path = filepath.with_suffix(".nfo")
|
|
||||||
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage, path=nfo_path):
|
|
||||||
logger.info(f"已存在nfo文件:{nfo_path}")
|
|
||||||
return
|
|
||||||
__save_file(_fileitem=parent, _path=nfo_path, _content=movie_nfo)
|
__save_file(_fileitem=parent, _path=nfo_path, _content=movie_nfo)
|
||||||
else:
|
else:
|
||||||
# 电影目录
|
# 电影目录
|
||||||
@@ -419,7 +420,12 @@ class MediaChain(ChainBase, metaclass=Singleton):
|
|||||||
else:
|
else:
|
||||||
# 电视剧
|
# 电视剧
|
||||||
if fileitem.type == "file":
|
if fileitem.type == "file":
|
||||||
# 当前为集文件,重新识别季集
|
# 是否已存在
|
||||||
|
nfo_path = filepath.with_suffix(".nfo")
|
||||||
|
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage, path=nfo_path):
|
||||||
|
logger.debug(f"已存在nfo文件:{nfo_path}")
|
||||||
|
return
|
||||||
|
# 重新识别季集
|
||||||
file_meta = MetaInfoPath(filepath)
|
file_meta = MetaInfoPath(filepath)
|
||||||
if not file_meta.begin_episode:
|
if not file_meta.begin_episode:
|
||||||
logger.warn(f"{filepath.name} 无法识别文件集数!")
|
logger.warn(f"{filepath.name} 无法识别文件集数!")
|
||||||
@@ -435,10 +441,6 @@ class MediaChain(ChainBase, metaclass=Singleton):
|
|||||||
logger.warn(f"{filepath.name} nfo生成失败!")
|
logger.warn(f"{filepath.name} nfo生成失败!")
|
||||||
return
|
return
|
||||||
# 保存或上传nfo文件到上级目录
|
# 保存或上传nfo文件到上级目录
|
||||||
nfo_path = filepath.with_suffix(".nfo")
|
|
||||||
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage, path=nfo_path):
|
|
||||||
logger.info(f"已存在nfo文件:{nfo_path}")
|
|
||||||
return
|
|
||||||
__save_file(_fileitem=parent, _path=nfo_path, _content=episode_nfo)
|
__save_file(_fileitem=parent, _path=nfo_path, _content=episode_nfo)
|
||||||
# 获取集的图片
|
# 获取集的图片
|
||||||
image_dict = self.metadata_img(mediainfo=file_mediainfo,
|
image_dict = self.metadata_img(mediainfo=file_mediainfo,
|
||||||
@@ -468,16 +470,17 @@ class MediaChain(ChainBase, metaclass=Singleton):
|
|||||||
# 识别文件夹名称
|
# 识别文件夹名称
|
||||||
season_meta = MetaInfo(filepath.name)
|
season_meta = MetaInfo(filepath.name)
|
||||||
if season_meta.begin_season:
|
if season_meta.begin_season:
|
||||||
|
# 是否已存在
|
||||||
|
nfo_path = filepath / "season.nfo"
|
||||||
|
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage, path=nfo_path):
|
||||||
|
logger.debug(f"已存在nfo文件:{nfo_path}")
|
||||||
|
return
|
||||||
# 当前目录有季号,生成季nfo
|
# 当前目录有季号,生成季nfo
|
||||||
season_nfo = self.metadata_nfo(meta=meta, mediainfo=mediainfo, season=season_meta.begin_season)
|
season_nfo = self.metadata_nfo(meta=meta, mediainfo=mediainfo, season=season_meta.begin_season)
|
||||||
if not season_nfo:
|
if not season_nfo:
|
||||||
logger.warn(f"无法生成电视剧季nfo文件:{meta.name}")
|
logger.warn(f"无法生成电视剧季nfo文件:{meta.name}")
|
||||||
return
|
return
|
||||||
# 写入nfo到根目录
|
# 写入nfo到根目录
|
||||||
nfo_path = filepath / "season.nfo"
|
|
||||||
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage, path=nfo_path):
|
|
||||||
logger.info(f"已存在nfo文件:{nfo_path}")
|
|
||||||
return
|
|
||||||
__save_file(_fileitem=fileitem, _path=nfo_path, _content=season_nfo)
|
__save_file(_fileitem=fileitem, _path=nfo_path, _content=season_nfo)
|
||||||
# TMDB季poster图片
|
# TMDB季poster图片
|
||||||
image_dict = self.metadata_img(mediainfo=mediainfo, season=season_meta.begin_season)
|
image_dict = self.metadata_img(mediainfo=mediainfo, season=season_meta.begin_season)
|
||||||
@@ -495,16 +498,17 @@ class MediaChain(ChainBase, metaclass=Singleton):
|
|||||||
__save_file(_fileitem=fileitem, _path=image_path, _content=content)
|
__save_file(_fileitem=fileitem, _path=image_path, _content=content)
|
||||||
# 判断当前目录是不是剧集根目录
|
# 判断当前目录是不是剧集根目录
|
||||||
if season_meta.name:
|
if season_meta.name:
|
||||||
|
# 是否已存在
|
||||||
|
nfo_path = filepath / "tvshow.nfo"
|
||||||
|
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage, path=nfo_path):
|
||||||
|
logger.debug(f"已存在nfo文件:{nfo_path}")
|
||||||
|
return
|
||||||
# 当前目录有名称,生成tvshow nfo 和 tv图片
|
# 当前目录有名称,生成tvshow nfo 和 tv图片
|
||||||
tv_nfo = self.metadata_nfo(meta=meta, mediainfo=mediainfo)
|
tv_nfo = self.metadata_nfo(meta=meta, mediainfo=mediainfo)
|
||||||
if not tv_nfo:
|
if not tv_nfo:
|
||||||
logger.warn(f"无法生成电视剧nfo文件:{meta.name}")
|
logger.warn(f"无法生成电视剧nfo文件:{meta.name}")
|
||||||
return
|
return
|
||||||
# 写入tvshow nfo到根目录
|
# 写入tvshow nfo到根目录
|
||||||
nfo_path = filepath / "tvshow.nfo"
|
|
||||||
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage, path=nfo_path):
|
|
||||||
logger.info(f"已存在nfo文件:{nfo_path}")
|
|
||||||
return
|
|
||||||
__save_file(_fileitem=fileitem, _path=nfo_path, _content=tv_nfo)
|
__save_file(_fileitem=fileitem, _path=nfo_path, _content=tv_nfo)
|
||||||
# 生成目录图片
|
# 生成目录图片
|
||||||
image_dict = self.metadata_img(mediainfo=mediainfo)
|
image_dict = self.metadata_img(mediainfo=mediainfo)
|
||||||
|
|||||||
Reference in New Issue
Block a user