mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-04-05 11:47:50 +08:00
fix api
This commit is contained in:
@@ -22,20 +22,18 @@ def calendar(page: int = 1,
|
||||
|
||||
|
||||
@router.get("/subjects", summary="搜索Bangumi", response_model=List[schemas.MediaInfo])
|
||||
def bangumi_subjects(type: int,
|
||||
cat: int,
|
||||
sort: str,
|
||||
year: int,
|
||||
page: int = 1,
|
||||
count: int = 20,
|
||||
def bangumi_subjects(type: int = 2,
|
||||
cat: int = None,
|
||||
sort: str = 'rank',
|
||||
year: int = None,
|
||||
limit: int = 30,
|
||||
offset: int = 0,
|
||||
_: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
||||
"""
|
||||
搜索Bangumi
|
||||
"""
|
||||
medias = BangumiChain().bangumi_discover(type=type, cat=cat, sort=sort, year=year)
|
||||
if medias:
|
||||
return [media.to_dict() for media in medias[(page - 1) * count: page * count]]
|
||||
return []
|
||||
return RecommendChain().bangumi_discover(type=type, cat=cat, sort=sort, year=year,
|
||||
limit=limit, offset=offset)
|
||||
|
||||
|
||||
@router.get("/credits/{bangumiid}", summary="查询Bangumi演职员表", response_model=List[schemas.MediaPerson])
|
||||
@@ -78,13 +76,14 @@ def bangumi_person(person_id: int,
|
||||
@router.get("/person/credits/{person_id}", summary="人物参演作品", response_model=List[schemas.MediaInfo])
|
||||
def bangumi_person_credits(person_id: int,
|
||||
page: int = 1,
|
||||
count: int = 20,
|
||||
_: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
||||
"""
|
||||
根据人物ID查询人物参演作品
|
||||
"""
|
||||
medias = BangumiChain().person_credits(person_id=person_id)
|
||||
if medias:
|
||||
return [media.to_dict() for media in medias[(page - 1) * 20: page * 20]]
|
||||
return [media.to_dict() for media in medias[(page - 1) * count: page * count]]
|
||||
return []
|
||||
|
||||
|
||||
|
||||
@@ -119,6 +119,7 @@ def tmdb_movies(sort_by: str = "popularity.desc",
|
||||
with_genres: str = "",
|
||||
with_original_language: str = "",
|
||||
with_keywords: str = "",
|
||||
with_watch_providers: str = "",
|
||||
vote_average: float = 0,
|
||||
vote_count: int = 0,
|
||||
release_date: str = "",
|
||||
@@ -131,6 +132,7 @@ def tmdb_movies(sort_by: str = "popularity.desc",
|
||||
with_genres=with_genres,
|
||||
with_original_language=with_original_language,
|
||||
with_keywords=with_keywords,
|
||||
with_watch_providers=with_watch_providers,
|
||||
vote_average=vote_average,
|
||||
vote_count=vote_count,
|
||||
release_date=release_date,
|
||||
@@ -142,6 +144,7 @@ def tmdb_tvs(sort_by: str = "popularity.desc",
|
||||
with_genres: str = "",
|
||||
with_original_language: str = "",
|
||||
with_keywords: str = "",
|
||||
with_watch_providers: str = "",
|
||||
vote_average: float = 0,
|
||||
vote_count: int = 0,
|
||||
release_date: str = "",
|
||||
@@ -154,6 +157,7 @@ def tmdb_tvs(sort_by: str = "popularity.desc",
|
||||
with_genres=with_genres,
|
||||
with_original_language=with_original_language,
|
||||
with_keywords=with_keywords,
|
||||
with_watch_providers=with_watch_providers,
|
||||
vote_average=vote_average,
|
||||
vote_count=vote_count,
|
||||
release_date=release_date,
|
||||
|
||||
@@ -17,7 +17,7 @@ class BangumiChain(ChainBase, metaclass=Singleton):
|
||||
"""
|
||||
return self.run_module("bangumi_calendar")
|
||||
|
||||
def bangumi_discover(self, **kwargs) -> Optional[List[MediaInfo]]:
|
||||
def discover(self, **kwargs) -> Optional[List[MediaInfo]]:
|
||||
"""
|
||||
发现Bangumi番剧
|
||||
"""
|
||||
|
||||
@@ -161,6 +161,7 @@ class RecommendChain(ChainBase, metaclass=Singleton):
|
||||
with_genres: str = "",
|
||||
with_original_language: str = "",
|
||||
with_keywords: str = "",
|
||||
with_watch_providers: str = "",
|
||||
vote_average: float = 0,
|
||||
vote_count: int = 0,
|
||||
release_date: str = "",
|
||||
@@ -173,6 +174,7 @@ class RecommendChain(ChainBase, metaclass=Singleton):
|
||||
with_genres=with_genres,
|
||||
with_original_language=with_original_language,
|
||||
with_keywords=with_keywords,
|
||||
with_watch_providers=with_watch_providers,
|
||||
vote_average=vote_average,
|
||||
vote_count=vote_count,
|
||||
release_date=release_date,
|
||||
@@ -185,6 +187,7 @@ class RecommendChain(ChainBase, metaclass=Singleton):
|
||||
with_genres: str = "",
|
||||
with_original_language: str = "zh|en|ja|ko",
|
||||
with_keywords: str = "",
|
||||
with_watch_providers: str = "",
|
||||
vote_average: float = 0,
|
||||
vote_count: int = 0,
|
||||
release_date: str = "",
|
||||
@@ -197,6 +200,7 @@ class RecommendChain(ChainBase, metaclass=Singleton):
|
||||
with_genres=with_genres,
|
||||
with_original_language=with_original_language,
|
||||
with_keywords=with_keywords,
|
||||
with_watch_providers=with_watch_providers,
|
||||
vote_average=vote_average,
|
||||
vote_count=vote_count,
|
||||
release_date=release_date,
|
||||
@@ -221,6 +225,23 @@ class RecommendChain(ChainBase, metaclass=Singleton):
|
||||
medias = self.bangumichain.calendar()
|
||||
return [media.to_dict() for media in medias[(page - 1) * count: page * count]] if medias else []
|
||||
|
||||
@log_execution_time(logger=logger)
|
||||
@cached(ttl=recommend_ttl, region=recommend_cache_region)
|
||||
def bangumi_discover(self, type: int = 2,
|
||||
cat: int = None,
|
||||
sort: str = 'rank',
|
||||
year: int = None,
|
||||
count: int = 30,
|
||||
page: int = 1) -> Any:
|
||||
"""
|
||||
搜索Bangumi
|
||||
"""
|
||||
medias = self.bangumichain.discover(type=type, cat=cat, sort=sort, year=year,
|
||||
limit=count, offset=(page - 1) * count)
|
||||
if medias:
|
||||
return [media.to_dict() for media in medias]
|
||||
return []
|
||||
|
||||
@log_execution_time(logger=logger)
|
||||
@cached(ttl=recommend_ttl, region=recommend_cache_region)
|
||||
def douban_movie_showing(self, page: int = 1, count: int = 30) -> Any:
|
||||
|
||||
@@ -19,6 +19,7 @@ class TmdbChain(ChainBase, metaclass=Singleton):
|
||||
with_genres: str,
|
||||
with_original_language: str,
|
||||
with_keywords: str,
|
||||
with_watch_providers: str,
|
||||
vote_average: float,
|
||||
vote_count: int,
|
||||
release_date: str,
|
||||
@@ -29,6 +30,7 @@ class TmdbChain(ChainBase, metaclass=Singleton):
|
||||
:param with_genres: 类型
|
||||
:param with_original_language: 语言
|
||||
:param with_keywords: 关键字
|
||||
:param with_watch_providers: 提供商
|
||||
:param vote_average: 评分
|
||||
:param vote_count: 评分人数
|
||||
:param release_date: 上映日期
|
||||
@@ -36,10 +38,15 @@ class TmdbChain(ChainBase, metaclass=Singleton):
|
||||
:return: 媒体信息列表
|
||||
"""
|
||||
return self.run_module("tmdb_discover", mtype=mtype,
|
||||
sort_by=sort_by, with_genres=with_genres,
|
||||
with_original_language=with_original_language, with_keywords=with_keywords,
|
||||
vote_average=vote_average, vote_count=vote_count,
|
||||
release_date=release_date, page=page)
|
||||
sort_by=sort_by,
|
||||
with_genres=with_genres,
|
||||
with_original_language=with_original_language,
|
||||
with_keywords=with_keywords,
|
||||
with_watch_providers=with_watch_providers,
|
||||
vote_average=vote_average,
|
||||
vote_count=vote_count,
|
||||
release_date=release_date,
|
||||
page=page)
|
||||
|
||||
def tmdb_trending(self, page: int = 1) -> Optional[List[MediaInfo]]:
|
||||
"""
|
||||
|
||||
@@ -356,14 +356,24 @@ class TheMovieDbModule(_ModuleBase):
|
||||
return None
|
||||
return self.scraper.get_metadata_img(mediainfo=mediainfo, season=season, episode=episode)
|
||||
|
||||
def tmdb_discover(self, mtype: MediaType, sort_by: str, with_genres: str, with_original_language: str,
|
||||
vote_average: float, release_date: str, page: int = 1) -> Optional[List[MediaInfo]]:
|
||||
def tmdb_discover(self, mtype: MediaType, sort_by: str,
|
||||
with_genres: str,
|
||||
with_original_language: str,
|
||||
with_keywords: str,
|
||||
with_watch_providers: str,
|
||||
vote_average: float,
|
||||
vote_count: int,
|
||||
release_date: str,
|
||||
page: int = 1) -> Optional[List[MediaInfo]]:
|
||||
"""
|
||||
:param mtype: 媒体类型
|
||||
:param sort_by: 排序方式
|
||||
:param with_genres: 类型
|
||||
:param with_original_language: 语言
|
||||
:param with_keywords: 关键字
|
||||
:param with_watch_providers: 提供商
|
||||
:param vote_average: 评分
|
||||
:param vote_count: 评分人数
|
||||
:param release_date: 发布日期
|
||||
:param page: 页码
|
||||
:return: 媒体信息列表
|
||||
@@ -373,7 +383,10 @@ class TheMovieDbModule(_ModuleBase):
|
||||
"sort_by": sort_by,
|
||||
"with_genres": with_genres,
|
||||
"with_original_language": with_original_language,
|
||||
"with_keywords": with_keywords,
|
||||
"with_watch_providers": with_watch_providers,
|
||||
"vote_average.gte": vote_average,
|
||||
"vote_count.gte": vote_count,
|
||||
"release_date.gte": release_date,
|
||||
"page": page
|
||||
})
|
||||
@@ -382,7 +395,10 @@ class TheMovieDbModule(_ModuleBase):
|
||||
"sort_by": sort_by,
|
||||
"with_genres": with_genres,
|
||||
"with_original_language": with_original_language,
|
||||
"with_keywords": with_keywords,
|
||||
"with_watch_providers": with_watch_providers,
|
||||
"vote_average.gte": vote_average,
|
||||
"vote_count.gte": vote_count,
|
||||
"release_date.gte": release_date,
|
||||
"page": page
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user