fix #486 季图片优先使用TMDB的
This commit is contained in:
parent
d836b385ae
commit
fa23012adb
@ -333,7 +333,7 @@ class FanartModule(_ModuleBase):
|
|||||||
if not result or result.get('status') == 'error':
|
if not result or result.get('status') == 'error':
|
||||||
logger.warn(f"没有获取到 {mediainfo.title_year} 的Fanart图片数据")
|
logger.warn(f"没有获取到 {mediainfo.title_year} 的Fanart图片数据")
|
||||||
return
|
return
|
||||||
# FIXME 季图片要区分季号
|
# 获取所有图片
|
||||||
for name, images in result.items():
|
for name, images in result.items():
|
||||||
if not images:
|
if not images:
|
||||||
continue
|
continue
|
||||||
@ -341,10 +341,17 @@ class FanartModule(_ModuleBase):
|
|||||||
continue
|
continue
|
||||||
# 按欢迎程度倒排
|
# 按欢迎程度倒排
|
||||||
images.sort(key=lambda x: int(x.get('likes', 0)), reverse=True)
|
images.sort(key=lambda x: int(x.get('likes', 0)), reverse=True)
|
||||||
|
# 取第一张图片
|
||||||
|
image_obj = images[0]
|
||||||
# 图片属性xx_path
|
# 图片属性xx_path
|
||||||
image_name = self.__name(name)
|
image_name = self.__name(name)
|
||||||
|
image_season = image_obj.get('season')
|
||||||
|
# 设置图片
|
||||||
|
if image_name.startswith("season") and image_season:
|
||||||
|
# 季图片格式 seasonxx-poster
|
||||||
|
image_name = f"season{str(image_season).rjust(2, '0')}-{image_name[6:]}"
|
||||||
if not mediainfo.get_image(image_name):
|
if not mediainfo.get_image(image_name):
|
||||||
mediainfo.set_image(image_name, images[0].get('url'))
|
mediainfo.set_image(image_name, image_obj.get('url'))
|
||||||
|
|
||||||
return mediainfo
|
return mediainfo
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class TmdbScraper:
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# 电影
|
# 电影,路径为文件名 名称/名称.xxx 或者蓝光原盘目录 名称/名称
|
||||||
if mediainfo.type == MediaType.MOVIE:
|
if mediainfo.type == MediaType.MOVIE:
|
||||||
# 不已存在时才处理
|
# 不已存在时才处理
|
||||||
if not file_path.with_name("movie.nfo").exists() \
|
if not file_path.with_name("movie.nfo").exists() \
|
||||||
@ -91,20 +91,17 @@ class TmdbScraper:
|
|||||||
# URL
|
# URL
|
||||||
url = f"https://{settings.TMDB_IMAGE_DOMAIN}/t/p/original{seasoninfo.get('poster_path')}"
|
url = f"https://{settings.TMDB_IMAGE_DOMAIN}/t/p/original{seasoninfo.get('poster_path')}"
|
||||||
self.__save_image(url, file_path.parent.with_name(f"season{sea_seq}-poster{ext}"))
|
self.__save_image(url, file_path.parent.with_name(f"season{sea_seq}-poster{ext}"))
|
||||||
# FIXME 季的其它图片
|
# 季的其它图片
|
||||||
for attr_name, attr_value in vars(mediainfo).items():
|
for attr_name, attr_value in vars(mediainfo).items():
|
||||||
if attr_value \
|
if attr_value \
|
||||||
and attr_name.startswith("season") \
|
and attr_name.startswith("season") \
|
||||||
and not attr_name.endswith("poster") \
|
and not attr_name.endswith("poster_path") \
|
||||||
and attr_value \
|
and attr_value \
|
||||||
and isinstance(attr_value, str) \
|
and isinstance(attr_value, str) \
|
||||||
and attr_value.startswith("http"):
|
and attr_value.startswith("http"):
|
||||||
image_name = attr_name.replace("_path",
|
image_name = attr_name.replace("_path", "") + Path(attr_value).suffix
|
||||||
"").replace("season",
|
|
||||||
f"{sea_seq}-") \
|
|
||||||
+ Path(attr_value).suffix
|
|
||||||
self.__save_image(url=attr_value,
|
self.__save_image(url=attr_value,
|
||||||
file_path=file_path.parent.with_name(f"season{image_name}"))
|
file_path=file_path.parent.with_name(image_name))
|
||||||
# 查询集详情
|
# 查询集详情
|
||||||
episodeinfo = __get_episode_detail(seasoninfo, meta.begin_episode)
|
episodeinfo = __get_episode_detail(seasoninfo, meta.begin_episode)
|
||||||
if episodeinfo:
|
if episodeinfo:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user