add remote transfer
This commit is contained in:
@ -775,14 +775,15 @@ class DoubanModule(_ModuleBase):
|
||||
return None
|
||||
return self.scraper.get_metadata_nfo(mediainfo=mediainfo, season=season)
|
||||
|
||||
def metadata_img(self, mediainfo: MediaInfo, **kwargs) -> Optional[dict]:
|
||||
def metadata_img(self, mediainfo: MediaInfo, season: int = None) -> Optional[dict]:
|
||||
"""
|
||||
获取图片名称和url
|
||||
:param mediainfo: 媒体信息
|
||||
:param season: 季号
|
||||
"""
|
||||
if settings.SCRAP_SOURCE != "douban":
|
||||
return None
|
||||
return self.scraper.get_metadata_img(mediainfo=mediainfo)
|
||||
return self.scraper.get_metadata_img(mediainfo=mediainfo, season=season)
|
||||
|
||||
def obtain_images(self, mediainfo: MediaInfo) -> Optional[MediaInfo]:
|
||||
"""
|
||||
|
@ -39,12 +39,16 @@ class DoubanScraper:
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def get_metadata_img(mediainfo: MediaInfo) -> Optional[dict]:
|
||||
def get_metadata_img(mediainfo: MediaInfo, season: int = None) -> Optional[dict]:
|
||||
"""
|
||||
获取图片内容
|
||||
:param mediainfo: 媒体信息
|
||||
:param season: 季号
|
||||
"""
|
||||
ret_dict = {}
|
||||
if season:
|
||||
# 豆瓣无季图片
|
||||
return {}
|
||||
if mediainfo.poster_path:
|
||||
ret_dict[f"poster{Path(mediainfo.poster_path).suffix}"] = mediainfo.poster_path
|
||||
if mediainfo.backdrop_path:
|
||||
|
@ -65,24 +65,24 @@ class TmdbScraper:
|
||||
:param season: 季号
|
||||
"""
|
||||
images = {}
|
||||
if mediainfo.type == MediaType.MOVIE:
|
||||
for attr_name, attr_value in vars(mediainfo).items():
|
||||
if attr_value \
|
||||
and attr_name.endswith("_path") \
|
||||
and attr_value \
|
||||
and isinstance(attr_value, str) \
|
||||
and attr_value.startswith("http"):
|
||||
image_name = attr_name.replace("_path", "") + Path(attr_value).suffix
|
||||
images[image_name] = attr_value
|
||||
else:
|
||||
if season:
|
||||
# 查询季信息
|
||||
seasoninfo = self.tmdb.get_tv_season_detail(mediainfo.tmdb_id, season)
|
||||
if seasoninfo:
|
||||
# TMDB季poster图片
|
||||
poster_name, poster_url = self.get_season_poster(seasoninfo, season)
|
||||
if poster_name and poster_url:
|
||||
images[poster_name] = poster_url
|
||||
if season:
|
||||
# 只需要季的图片
|
||||
seasoninfo = self.tmdb.get_tv_season_detail(mediainfo.tmdb_id, season)
|
||||
if seasoninfo:
|
||||
# TMDB季poster图片
|
||||
poster_name, poster_url = self.get_season_poster(seasoninfo, season)
|
||||
if poster_name and poster_url:
|
||||
images[poster_name] = poster_url
|
||||
return images
|
||||
# 主媒体图片
|
||||
for attr_name, attr_value in vars(mediainfo).items():
|
||||
if attr_value \
|
||||
and attr_name.endswith("_path") \
|
||||
and attr_value \
|
||||
and isinstance(attr_value, str) \
|
||||
and attr_value.startswith("http"):
|
||||
image_name = attr_name.replace("_path", "") + Path(attr_value).suffix
|
||||
images[image_name] = attr_value
|
||||
return images
|
||||
|
||||
@staticmethod
|
||||
|
Reference in New Issue
Block a user