Merge pull request #2898 from thsrite/dev

This commit is contained in:
jxxghp
2024-10-22 10:54:53 +08:00
committed by GitHub
2 changed files with 11 additions and 7 deletions

View File

@@ -338,6 +338,7 @@ class MediaChain(ChainBase, metaclass=Singleton):
tmp_file = settings.TEMP_PATH / _path.name
tmp_file.write_bytes(_content)
logger.info(f"保存文件:【{_fileitem.storage}{_path}")
_fileitem.path = str(_path.parent)
self.storagechain.upload_file(fileitem=_fileitem, path=tmp_file)
if tmp_file.exists():
tmp_file.unlink()
@@ -402,7 +403,8 @@ class MediaChain(ChainBase, metaclass=Singleton):
and attr_value.startswith("http"):
image_name = attr_name.replace("_path", "") + Path(attr_value).suffix
image_path = filepath / image_name
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage, path=image_path):
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage,
path=image_path):
logger.info(f"已存在图片文件:{image_path}")
continue
# 下载图片
@@ -476,7 +478,8 @@ class MediaChain(ChainBase, metaclass=Singleton):
if image_dict:
for image_name, image_url in image_dict.items():
image_path = filepath.with_name(image_name)
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage, path=image_path):
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage,
path=image_path):
logger.info(f"已存在图片文件:{image_path}")
continue
# 下载图片
@@ -500,7 +503,8 @@ class MediaChain(ChainBase, metaclass=Singleton):
if image_dict:
for image_name, image_url in image_dict.items():
image_path = filepath / image_name
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage, path=image_path):
if not overwrite and self.storagechain.get_file_item(storage=fileitem.storage,
path=image_path):
logger.info(f"已存在图片文件:{image_path}")
continue
# 下载图片

View File

@@ -58,19 +58,19 @@ class TmdbScraper:
"""
images = {}
if season:
# 只需要的图片
# 只需要的图片
if episode:
# 的图片
# 的图片
seasoninfo = self.tmdb.get_tv_season_detail(mediainfo.tmdb_id, season)
if seasoninfo:
episodeinfo = self.__get_episode_detail(seasoninfo, episode)
if episodeinfo:
if episodeinfo and episodeinfo.get("still_path"):
# TMDB集still图片
still_name = f"{episode}"
still_url = f"https://{settings.TMDB_IMAGE_DOMAIN}/t/p/original{episodeinfo.get('still_path')}"
images[still_name] = still_url
else:
# 的图片
# 的图片
seasoninfo = self.tmdb.get_tv_season_detail(mediainfo.tmdb_id, season)
if seasoninfo:
# TMDB季poster图片