mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
refactor(config): retire RuntimeSettingsCompat host usage
This commit is contained in:
@@ -94,13 +94,13 @@ class TheMovieDbModule(MediaAuxiliaryProviderMixin, _ModuleBase):
|
||||
"""
|
||||
测试模块连接性
|
||||
"""
|
||||
ret = RequestUtils(ua=get_runtime_setting("NORMAL_USER_AGENT"), proxies=get_runtime_setting("PROXY")).get_res(
|
||||
f"https://{get_runtime_setting("TMDB_API_DOMAIN")}/3/movie/550?api_key={get_runtime_setting("TMDB_API_KEY")}")
|
||||
ret = RequestUtils(ua=get_runtime_setting('NORMAL_USER_AGENT'), proxies=get_runtime_setting('PROXY')).get_res(
|
||||
f"https://{get_runtime_setting('TMDB_API_DOMAIN')}/3/movie/550?api_key={get_runtime_setting('TMDB_API_KEY')}")
|
||||
if ret and ret.status_code == 200:
|
||||
return True, ""
|
||||
elif ret:
|
||||
return False, f"无法连接 {get_runtime_setting("TMDB_API_DOMAIN")},错误码:{ret.status_code}"
|
||||
return False, f"{get_runtime_setting("TMDB_API_DOMAIN")} 网络连接失败"
|
||||
return False, f"无法连接 {get_runtime_setting('TMDB_API_DOMAIN')},错误码:{ret.status_code}"
|
||||
return False, f"{get_runtime_setting('TMDB_API_DOMAIN')} 网络连接失败"
|
||||
|
||||
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
||||
pass
|
||||
@@ -122,7 +122,7 @@ class TheMovieDbModule(MediaAuxiliaryProviderMixin, _ModuleBase):
|
||||
if not tmdbid and not meta:
|
||||
return False
|
||||
|
||||
selected_source = normalize_media_source(media_source or get_runtime_setting("RECOGNIZE_SOURCE"))
|
||||
selected_source = normalize_media_source(media_source or get_runtime_setting('RECOGNIZE_SOURCE'))
|
||||
if meta and not tmdbid and selected_source != MediaSource.TMDB:
|
||||
return False
|
||||
|
||||
@@ -973,7 +973,7 @@ class TheMovieDbModule(MediaAuxiliaryProviderMixin, _ModuleBase):
|
||||
:param season: 季号
|
||||
:param episode: 集号
|
||||
"""
|
||||
if (mediainfo.scrape_source or get_runtime_setting("SCRAP_SOURCE")) != "themoviedb":
|
||||
if (mediainfo.scrape_source or get_runtime_setting('SCRAP_SOURCE')) != "themoviedb":
|
||||
return None
|
||||
return self.scraper.get_metadata_nfo(meta=meta, mediainfo=mediainfo, season=season, episode=episode)
|
||||
|
||||
@@ -985,7 +985,7 @@ class TheMovieDbModule(MediaAuxiliaryProviderMixin, _ModuleBase):
|
||||
:param season: 季号
|
||||
:param episode: 集号
|
||||
"""
|
||||
if (mediainfo.scrape_source or get_runtime_setting("SCRAP_SOURCE")) != "themoviedb":
|
||||
if (mediainfo.scrape_source or get_runtime_setting('SCRAP_SOURCE')) != "themoviedb":
|
||||
return None
|
||||
return self.scraper.get_metadata_img(mediainfo=mediainfo, season=season, episode=episode)
|
||||
|
||||
@@ -1106,7 +1106,7 @@ class TheMovieDbModule(MediaAuxiliaryProviderMixin, _ModuleBase):
|
||||
:param mediainfo: 媒体信息
|
||||
:return: None 表示不处理,MediaInfo 表示继续处理
|
||||
"""
|
||||
if mediainfo.media_source != "themoviedb" and get_runtime_setting("RECOGNIZE_SOURCE") != "themoviedb":
|
||||
if mediainfo.media_source != "themoviedb" and get_runtime_setting('RECOGNIZE_SOURCE') != "themoviedb":
|
||||
return None
|
||||
if not mediainfo.tmdb_id:
|
||||
return mediainfo
|
||||
@@ -1147,15 +1147,15 @@ class TheMovieDbModule(MediaAuxiliaryProviderMixin, _ModuleBase):
|
||||
# 背景图
|
||||
if not mediainfo.backdrop_path:
|
||||
if image_path := cls._pick_best_tmdb_image(images.get("backdrops")):
|
||||
mediainfo.backdrop_path = get_runtime_setting("TMDB_IMAGE_URL")(image_path)
|
||||
mediainfo.backdrop_path = get_runtime_setting('TMDB_IMAGE_URL')(image_path)
|
||||
# 标志
|
||||
if not mediainfo.logo_path:
|
||||
if image_path := cls._pick_best_tmdb_image(images.get("logos")):
|
||||
mediainfo.logo_path = get_runtime_setting("TMDB_IMAGE_URL")(image_path)
|
||||
mediainfo.logo_path = get_runtime_setting('TMDB_IMAGE_URL')(image_path)
|
||||
# 海报
|
||||
if not mediainfo.poster_path:
|
||||
if image_path := cls._pick_best_tmdb_image(images.get("posters")):
|
||||
mediainfo.poster_path = get_runtime_setting("TMDB_IMAGE_URL")(image_path)
|
||||
mediainfo.poster_path = get_runtime_setting('TMDB_IMAGE_URL')(image_path)
|
||||
return mediainfo
|
||||
|
||||
def obtain_images(self, mediainfo: MediaInfo) -> Optional[MediaInfo]:
|
||||
@@ -1245,7 +1245,7 @@ class TheMovieDbModule(MediaAuxiliaryProviderMixin, _ModuleBase):
|
||||
image_path = seasoninfo.get(image_type.value)
|
||||
|
||||
if image_path:
|
||||
return get_runtime_setting("TMDB_IMAGE_URL")(image_path, image_prefix)
|
||||
return get_runtime_setting('TMDB_IMAGE_URL')(image_path, image_prefix)
|
||||
return None
|
||||
|
||||
def tmdb_movie_similar(self, tmdbid: int) -> List[MediaInfo]:
|
||||
|
||||
Reference in New Issue
Block a user