mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 16:07:01 +08:00
fix bug
This commit is contained in:
@@ -101,7 +101,7 @@ class ChainBase(metaclass=ABCMeta):
|
|||||||
try:
|
try:
|
||||||
module_name = module.get_name()
|
module_name = module.get_name()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.error(f"获取模块名称出错:{str(err)}")
|
logger.debug(f"获取模块名称出错:{str(err)}")
|
||||||
module_name = module_id
|
module_name = module_id
|
||||||
try:
|
try:
|
||||||
func = getattr(module, method)
|
func = getattr(module, method)
|
||||||
|
|||||||
+2
-2
@@ -127,11 +127,11 @@ class TmdbChain(ChainBase, metaclass=Singleton):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@cached(cache=TTLCache(maxsize=1, ttl=3600))
|
@cached(cache=TTLCache(maxsize=1, ttl=3600))
|
||||||
def get_trending_wallpapers(self, num: int = 10) -> Optional[List[str]]:
|
def get_trending_wallpapers(self, num: int = 10) -> List[str]:
|
||||||
"""
|
"""
|
||||||
获取所有流行壁纸
|
获取所有流行壁纸
|
||||||
"""
|
"""
|
||||||
infos = self.tmdb_trending()
|
infos = self.tmdb_trending()
|
||||||
if infos:
|
if infos:
|
||||||
return [info.backdrop_path for info in infos if info and info.backdrop_path][:num]
|
return [info.backdrop_path for info in infos if info and info.backdrop_path][:num]
|
||||||
return None
|
return []
|
||||||
|
|||||||
@@ -770,7 +770,7 @@ class TmdbApi:
|
|||||||
logger.debug(f"{tmdbid} 查询结果:{tmdbinfo.get('title')}")
|
logger.debug(f"{tmdbid} 查询结果:{tmdbinfo.get('title')}")
|
||||||
return tmdbinfo or {}
|
return tmdbinfo or {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __get_tv_detail(self,
|
def __get_tv_detail(self,
|
||||||
@@ -953,7 +953,7 @@ class TmdbApi:
|
|||||||
logger.debug(f"{tmdbid} 查询结果:{tmdbinfo.get('name')}")
|
logger.debug(f"{tmdbid} 查询结果:{tmdbinfo.get('name')}")
|
||||||
return tmdbinfo or {}
|
return tmdbinfo or {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_tv_season_detail(self, tmdbid: int, season: int):
|
def get_tv_season_detail(self, tmdbid: int, season: int):
|
||||||
@@ -1027,7 +1027,7 @@ class TmdbApi:
|
|||||||
tmdbinfo = self.season.details(tv_id=tmdbid, season_num=season)
|
tmdbinfo = self.season.details(tv_id=tmdbid, season_num=season)
|
||||||
return tmdbinfo or {}
|
return tmdbinfo or {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def get_tv_episode_detail(self, tmdbid: int, season: int, episode: int) -> dict:
|
def get_tv_episode_detail(self, tmdbid: int, season: int, episode: int) -> dict:
|
||||||
@@ -1044,7 +1044,7 @@ class TmdbApi:
|
|||||||
tmdbinfo = self.episode.details(tv_id=tmdbid, season_num=season, episode_num=episode)
|
tmdbinfo = self.episode.details(tv_id=tmdbid, season_num=season, episode_num=episode)
|
||||||
return tmdbinfo or {}
|
return tmdbinfo or {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def discover_movies(self, **kwargs) -> List[dict]:
|
def discover_movies(self, **kwargs) -> List[dict]:
|
||||||
@@ -1064,7 +1064,7 @@ class TmdbApi:
|
|||||||
info['media_type'] = MediaType.MOVIE
|
info['media_type'] = MediaType.MOVIE
|
||||||
return tmdbinfo or []
|
return tmdbinfo or []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def discover_tvs(self, **kwargs) -> List[dict]:
|
def discover_tvs(self, **kwargs) -> List[dict]:
|
||||||
@@ -1084,7 +1084,7 @@ class TmdbApi:
|
|||||||
info['media_type'] = MediaType.TV
|
info['media_type'] = MediaType.TV
|
||||||
return tmdbinfo or []
|
return tmdbinfo or []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def discover_trending(self, page: int = 1) -> List[dict]:
|
def discover_trending(self, page: int = 1) -> List[dict]:
|
||||||
@@ -1097,7 +1097,7 @@ class TmdbApi:
|
|||||||
logger.debug(f"正在获取流行趋势:page={page} ...")
|
logger.debug(f"正在获取流行趋势:page={page} ...")
|
||||||
return self.trending.all_week(page=page)
|
return self.trending.all_week(page=page)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_movie_images(self, tmdbid: int) -> dict:
|
def get_movie_images(self, tmdbid: int) -> dict:
|
||||||
@@ -1110,7 +1110,7 @@ class TmdbApi:
|
|||||||
logger.debug(f"正在获取电影图片:{tmdbid}...")
|
logger.debug(f"正在获取电影图片:{tmdbid}...")
|
||||||
return self.movie.images(movie_id=tmdbid) or {}
|
return self.movie.images(movie_id=tmdbid) or {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def get_tv_images(self, tmdbid: int) -> dict:
|
def get_tv_images(self, tmdbid: int) -> dict:
|
||||||
@@ -1123,7 +1123,7 @@ class TmdbApi:
|
|||||||
logger.debug(f"正在获取电视剧图片:{tmdbid}...")
|
logger.debug(f"正在获取电视剧图片:{tmdbid}...")
|
||||||
return self.tv.images(tv_id=tmdbid) or {}
|
return self.tv.images(tv_id=tmdbid) or {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def get_movie_similar(self, tmdbid: int) -> List[dict]:
|
def get_movie_similar(self, tmdbid: int) -> List[dict]:
|
||||||
@@ -1136,7 +1136,7 @@ class TmdbApi:
|
|||||||
logger.debug(f"正在获取相似电影:{tmdbid}...")
|
logger.debug(f"正在获取相似电影:{tmdbid}...")
|
||||||
return self.movie.similar(movie_id=tmdbid) or []
|
return self.movie.similar(movie_id=tmdbid) or []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_tv_similar(self, tmdbid: int) -> List[dict]:
|
def get_tv_similar(self, tmdbid: int) -> List[dict]:
|
||||||
@@ -1149,7 +1149,7 @@ class TmdbApi:
|
|||||||
logger.debug(f"正在获取相似电视剧:{tmdbid}...")
|
logger.debug(f"正在获取相似电视剧:{tmdbid}...")
|
||||||
return self.tv.similar(tv_id=tmdbid) or []
|
return self.tv.similar(tv_id=tmdbid) or []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_movie_recommend(self, tmdbid: int) -> List[dict]:
|
def get_movie_recommend(self, tmdbid: int) -> List[dict]:
|
||||||
@@ -1162,7 +1162,7 @@ class TmdbApi:
|
|||||||
logger.debug(f"正在获取推荐电影:{tmdbid}...")
|
logger.debug(f"正在获取推荐电影:{tmdbid}...")
|
||||||
return self.movie.recommendations(movie_id=tmdbid) or []
|
return self.movie.recommendations(movie_id=tmdbid) or []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_tv_recommend(self, tmdbid: int) -> List[dict]:
|
def get_tv_recommend(self, tmdbid: int) -> List[dict]:
|
||||||
@@ -1175,7 +1175,7 @@ class TmdbApi:
|
|||||||
logger.debug(f"正在获取推荐电视剧:{tmdbid}...")
|
logger.debug(f"正在获取推荐电视剧:{tmdbid}...")
|
||||||
return self.tv.recommendations(tv_id=tmdbid) or []
|
return self.tv.recommendations(tv_id=tmdbid) or []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_movie_credits(self, tmdbid: int, page: int = 1, count: int = 24) -> List[dict]:
|
def get_movie_credits(self, tmdbid: int, page: int = 1, count: int = 24) -> List[dict]:
|
||||||
@@ -1192,7 +1192,7 @@ class TmdbApi:
|
|||||||
return cast[(page - 1) * count: page * count]
|
return cast[(page - 1) * count: page * count]
|
||||||
return []
|
return []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_tv_credits(self, tmdbid: int, page: int = 1, count: int = 24) -> List[dict]:
|
def get_tv_credits(self, tmdbid: int, page: int = 1, count: int = 24) -> List[dict]:
|
||||||
@@ -1209,7 +1209,7 @@ class TmdbApi:
|
|||||||
return cast[(page - 1) * count: page * count]
|
return cast[(page - 1) * count: page * count]
|
||||||
return []
|
return []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_person_detail(self, person_id: int) -> dict:
|
def get_person_detail(self, person_id: int) -> dict:
|
||||||
@@ -1242,7 +1242,7 @@ class TmdbApi:
|
|||||||
logger.debug(f"正在获取人物详情:{person_id}...")
|
logger.debug(f"正在获取人物详情:{person_id}...")
|
||||||
return self.person.details(person_id=person_id) or {}
|
return self.person.details(person_id=person_id) or {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def get_person_credits(self, person_id: int, page: int = 1, count: int = 24) -> List[dict]:
|
def get_person_credits(self, person_id: int, page: int = 1, count: int = 24) -> List[dict]:
|
||||||
@@ -1263,7 +1263,7 @@ class TmdbApi:
|
|||||||
return cast[(page - 1) * count: page * count]
|
return cast[(page - 1) * count: page * count]
|
||||||
return []
|
return []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def clear_cache(self):
|
def clear_cache(self):
|
||||||
@@ -1301,7 +1301,7 @@ class TmdbApi:
|
|||||||
episode_years[order] = str(first_date).split("-")[0]
|
episode_years[order] = str(first_date).split("-")[0]
|
||||||
return episode_years
|
return episode_years
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
logger.error(str(e))
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
from typing import Optional
|
from typing import Optional, List
|
||||||
|
|
||||||
from cachetools import TTLCache, cached
|
from cachetools import TTLCache, cached
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ class WebUtils:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@cached(cache=TTLCache(maxsize=1, ttl=3600))
|
@cached(cache=TTLCache(maxsize=1, ttl=3600))
|
||||||
def get_bing_wallpapers(num: int = 7) -> Optional[str]:
|
def get_bing_wallpapers(num: int = 7) -> List[str]:
|
||||||
"""
|
"""
|
||||||
获取7天的Bing每日壁纸
|
获取7天的Bing每日壁纸
|
||||||
"""
|
"""
|
||||||
@@ -107,4 +107,4 @@ class WebUtils:
|
|||||||
return [f"https://cn.bing.com{image.get('url')}" for image in result.get('images') or []]
|
return [f"https://cn.bing.com{image.get('url')}" for image in result.get('images') or []]
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print(str(err))
|
print(str(err))
|
||||||
return None
|
return []
|
||||||
|
|||||||
Reference in New Issue
Block a user