fix api
This commit is contained in:
parent
220dede9c4
commit
f21c46edba
@ -316,7 +316,7 @@ class MediaInfo:
|
|||||||
self.year = self.release_date[:4]
|
self.year = self.release_date[:4]
|
||||||
# 季集信息
|
# 季集信息
|
||||||
if info.get('seasons'):
|
if info.get('seasons'):
|
||||||
self.season_info = [s.to_dict() for s in info.get('seasons')]
|
self.season_info = info.get('seasons')
|
||||||
for seainfo in info.get('seasons'):
|
for seainfo in info.get('seasons'):
|
||||||
# 季
|
# 季
|
||||||
season = seainfo.get("season_number")
|
season = seainfo.get("season_number")
|
||||||
|
@ -1105,7 +1105,7 @@ class TmdbHelper:
|
|||||||
info = self.movie.credits(movie_id=tmdbid) or {}
|
info = self.movie.credits(movie_id=tmdbid) or {}
|
||||||
cast = info.get('cast') or []
|
cast = info.get('cast') or []
|
||||||
if cast:
|
if cast:
|
||||||
return [c.to_dict() for c in 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))
|
print(str(e))
|
||||||
@ -1122,7 +1122,7 @@ class TmdbHelper:
|
|||||||
info = self.tv.credits(tv_id=tmdbid) or {}
|
info = self.tv.credits(tv_id=tmdbid) or {}
|
||||||
cast = info.get('cast') or []
|
cast = info.get('cast') or []
|
||||||
if cast:
|
if cast:
|
||||||
return [c.to_dict() for c in 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))
|
print(str(e))
|
||||||
@ -1136,11 +1136,7 @@ class TmdbHelper:
|
|||||||
return {}
|
return {}
|
||||||
try:
|
try:
|
||||||
logger.info(f"正在获取人物详情:{person_id}...")
|
logger.info(f"正在获取人物详情:{person_id}...")
|
||||||
info = self.person.details(person_id=person_id)
|
return self.person.details(person_id=person_id) or {}
|
||||||
if info:
|
|
||||||
info_dict = info.to_dict()
|
|
||||||
return info_dict
|
|
||||||
return {}
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
print(str(e))
|
||||||
return {}
|
return {}
|
||||||
@ -1156,7 +1152,7 @@ class TmdbHelper:
|
|||||||
info = self.person.movie_credits(person_id=person_id) or {}
|
info = self.person.movie_credits(person_id=person_id) or {}
|
||||||
cast = info.get('cast') or []
|
cast = info.get('cast') or []
|
||||||
if cast:
|
if cast:
|
||||||
return [c.to_dict() for c in 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))
|
print(str(e))
|
||||||
|
@ -68,8 +68,8 @@ class AsObj:
|
|||||||
return reversed(self._dict())
|
return reversed(self._dict())
|
||||||
|
|
||||||
if sys.version_info >= (3, 9):
|
if sys.version_info >= (3, 9):
|
||||||
def __class_getitem__(self, key):
|
def __class_getitem__(cls, key):
|
||||||
return self.__dict__.__class_getitem__(key)
|
return cls.__dict__.__class_getitem__(key)
|
||||||
|
|
||||||
def __ior__(self, value):
|
def __ior__(self, value):
|
||||||
return self._dict().__ior__(value)
|
return self._dict().__ior__(value)
|
||||||
|
@ -3,13 +3,12 @@
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
from functools import lru_cache
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import requests.exceptions
|
import requests.exceptions
|
||||||
|
|
||||||
from .as_obj import AsObj
|
|
||||||
from .exceptions import TMDbException
|
from .exceptions import TMDbException
|
||||||
from functools import lru_cache
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -196,4 +195,6 @@ class TMDb(object):
|
|||||||
if "success" in json and json["success"] is False:
|
if "success" in json and json["success"] is False:
|
||||||
raise TMDbException(json["status_message"])
|
raise TMDbException(json["status_message"])
|
||||||
|
|
||||||
return AsObj(json, key=key)
|
if key:
|
||||||
|
return json.get(key)
|
||||||
|
return json
|
||||||
|
@ -103,6 +103,10 @@ class MediaInfo(BaseModel):
|
|||||||
season_info: Optional[List[dict]] = []
|
season_info: Optional[List[dict]] = []
|
||||||
# 别名和译名
|
# 别名和译名
|
||||||
names: Optional[list] = []
|
names: Optional[list] = []
|
||||||
|
# 演员
|
||||||
|
actors: Optional[list] = []
|
||||||
|
# 导演
|
||||||
|
directors: Optional[list] = []
|
||||||
# 详情链接
|
# 详情链接
|
||||||
detail_link: Optional[str] = None
|
detail_link: Optional[str] = None
|
||||||
# 其它TMDB属性
|
# 其它TMDB属性
|
||||||
|
@ -40,10 +40,11 @@ class TmdbPerson(BaseModel):
|
|||||||
gender: Optional[int] = None
|
gender: Optional[int] = None
|
||||||
original_name: Optional[str] = None
|
original_name: Optional[str] = None
|
||||||
credit_id: Optional[str] = None
|
credit_id: Optional[str] = None
|
||||||
also_known_as: Optional[dict] = {}
|
also_known_as: Optional[list] = []
|
||||||
birthday: Optional[str] = None
|
birthday: Optional[str] = None
|
||||||
deathday: Optional[str] = None
|
deathday: Optional[str] = None
|
||||||
imdb_id: Optional[str] = None
|
imdb_id: Optional[str] = None
|
||||||
known_for_department: Optional[str] = None
|
known_for_department: Optional[str] = None
|
||||||
place_of_birth: Optional[str] = None
|
place_of_birth: Optional[str] = None
|
||||||
popularity: Optional[float] = None
|
popularity: Optional[float] = None
|
||||||
|
images: Optional[dict] = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user