add tmdb person api
This commit is contained in:
@ -372,3 +372,17 @@ class TheMovieDbModule(_ModuleBase):
|
||||
:param tmdbid: TMDBID
|
||||
"""
|
||||
return self.tmdb.get_tv_credits(tmdbid=tmdbid)
|
||||
|
||||
def credit_details(self, credit_id: str) -> List[dict]:
|
||||
"""
|
||||
根据TMDBID查询演职员详情
|
||||
:param credit_id: 人物ID
|
||||
"""
|
||||
return self.tmdb.get_credit_details(credit_id=credit_id)
|
||||
|
||||
def person_detail(self, person_id: int) -> dict:
|
||||
"""
|
||||
根据TMDBID查询人物详情
|
||||
:param person_id: 人物ID
|
||||
"""
|
||||
return self.tmdb.get_person_detail(person_id=person_id)
|
||||
|
@ -5,7 +5,7 @@ from urllib.parse import quote
|
||||
|
||||
import zhconv
|
||||
from lxml import etree
|
||||
from .tmdbv3api import TMDb, Search, Movie, TV, Season, Episode, Discover, Trending
|
||||
from .tmdbv3api import TMDb, Search, Movie, TV, Season, Episode, Discover, Trending, Credit, Person
|
||||
from .tmdbv3api.exceptions import TMDbException
|
||||
|
||||
from app.core.config import settings
|
||||
@ -20,11 +20,6 @@ class TmdbHelper:
|
||||
TMDB识别匹配
|
||||
"""
|
||||
|
||||
tmdb: TMDb = None
|
||||
search: Search = None
|
||||
movie: Movie = None
|
||||
tv: TV = None
|
||||
|
||||
def __init__(self):
|
||||
# TMDB主体
|
||||
self.tmdb = TMDb()
|
||||
@ -50,6 +45,8 @@ class TmdbHelper:
|
||||
self.episode = Episode()
|
||||
self.discover = Discover()
|
||||
self.trending = Trending()
|
||||
self.credit = Credit()
|
||||
self.person = Person()
|
||||
|
||||
def search_multiis(self, title: str) -> List[dict]:
|
||||
"""
|
||||
@ -1125,3 +1122,31 @@ class TmdbHelper:
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
return []
|
||||
|
||||
def get_credit_details(self, credit_id: str) -> List[dict]:
|
||||
"""
|
||||
获取演职员的详情
|
||||
"""
|
||||
if not self.credit:
|
||||
return []
|
||||
try:
|
||||
logger.info(f"正在获取演职员参演作品:{credit_id}...")
|
||||
info = self.credit.details(credit_id=credit_id) or {}
|
||||
return info
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
return []
|
||||
|
||||
def get_person_detail(self, person_id: int) -> dict:
|
||||
"""
|
||||
获取人物详情
|
||||
"""
|
||||
if not self.person:
|
||||
return {}
|
||||
try:
|
||||
logger.info(f"正在获取人物详情:{person_id}...")
|
||||
info = self.person.details(person_id=person_id) or {}
|
||||
return info
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
return {}
|
||||
|
Reference in New Issue
Block a user