fix api order
This commit is contained in:
@ -41,18 +41,6 @@ async def recognize_doubanid(doubanid: str,
|
||||
return context.to_dict()
|
||||
|
||||
|
||||
@router.get("/{doubanid}", summary="查询豆瓣详情", response_model=schemas.MediaInfo)
|
||||
async def douban_info(doubanid: str, _: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
||||
"""
|
||||
根据豆瓣ID查询豆瓣媒体信息
|
||||
"""
|
||||
doubaninfo = DoubanChain().douban_info(doubanid=doubanid)
|
||||
if doubaninfo:
|
||||
return MediaInfo(douban_info=doubaninfo).to_dict()
|
||||
else:
|
||||
return schemas.MediaInfo()
|
||||
|
||||
|
||||
@router.get("/movies", summary="豆瓣电影", response_model=List[schemas.MediaInfo])
|
||||
async def douban_movies(sort: str = "R",
|
||||
tags: str = "",
|
||||
@ -125,3 +113,16 @@ async def tv_weekly_global(page: int = 1,
|
||||
"""
|
||||
tvs = DoubanChain().tv_weekly_global(page=page, count=count)
|
||||
return [MediaInfo(douban_info=tv).to_dict() for tv in tvs]
|
||||
|
||||
|
||||
@router.get("/{doubanid}", summary="查询豆瓣详情", response_model=schemas.MediaInfo)
|
||||
async def douban_info(doubanid: str, _: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
||||
"""
|
||||
根据豆瓣ID查询豆瓣媒体信息
|
||||
"""
|
||||
doubaninfo = DoubanChain().douban_info(doubanid=doubanid)
|
||||
if doubaninfo:
|
||||
return MediaInfo(douban_info=doubaninfo).to_dict()
|
||||
else:
|
||||
return schemas.MediaInfo()
|
||||
|
||||
|
@ -36,20 +36,6 @@ async def tmdb_season_episodes(tmdbid: int, season: int,
|
||||
return episodes_info
|
||||
|
||||
|
||||
@router.get("/{tmdbid}", summary="TMDB详情", response_model=schemas.MediaInfo)
|
||||
async def tmdb_info(tmdbid: int, type_name: str,
|
||||
_: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
||||
"""
|
||||
根据TMDBID查询themoviedb媒体信息,type_name: 电影/电视剧
|
||||
"""
|
||||
mtype = MediaType.MOVIE if type_name == MediaType.MOVIE.value else MediaType.TV
|
||||
tmdbinfo = TmdbChain().tmdb_info(tmdbid=tmdbid, mtype=mtype)
|
||||
if not tmdbinfo:
|
||||
return schemas.MediaInfo()
|
||||
else:
|
||||
return MediaInfo(tmdb_info=tmdbinfo).to_dict()
|
||||
|
||||
|
||||
@router.get("/movies", summary="TMDB电影", response_model=List[schemas.MediaInfo])
|
||||
async def tmdb_movies(sort_by: str = "popularity.desc",
|
||||
with_genres: str = "",
|
||||
@ -98,3 +84,17 @@ async def tmdb_trending(page: int = 1,
|
||||
if not infos:
|
||||
return []
|
||||
return [MediaInfo(tmdb_info=info).to_dict() for info in infos]
|
||||
|
||||
|
||||
@router.get("/{tmdbid}", summary="TMDB详情", response_model=schemas.MediaInfo)
|
||||
async def tmdb_info(tmdbid: int, type_name: str,
|
||||
_: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
||||
"""
|
||||
根据TMDBID查询themoviedb媒体信息,type_name: 电影/电视剧
|
||||
"""
|
||||
mtype = MediaType.MOVIE if type_name == MediaType.MOVIE.value else MediaType.TV
|
||||
tmdbinfo = TmdbChain().tmdb_info(tmdbid=tmdbid, mtype=mtype)
|
||||
if not tmdbinfo:
|
||||
return schemas.MediaInfo()
|
||||
else:
|
||||
return MediaInfo(tmdb_info=tmdbinfo).to_dict()
|
||||
|
Reference in New Issue
Block a user