fix apis
This commit is contained in:
@@ -108,6 +108,15 @@ class ChainBase(AbstractSingleton, metaclass=Singleton):
|
||||
"""
|
||||
return self.__run_module("tvdb_info", tvdbid=tvdbid)
|
||||
|
||||
def tmdb_info(self, tmdbid: int, mtype: MediaType) -> Optional[dict]:
|
||||
"""
|
||||
获取TMDB信息
|
||||
:param tmdbid: int
|
||||
:param mtype: 媒体类型
|
||||
:return: TVDB信息
|
||||
"""
|
||||
return self.__run_module("tmdb_info", tmdbid=tmdbid, mtype=mtype)
|
||||
|
||||
def message_parser(self, body: Any, form: Any, args: Any) -> Optional[dict]:
|
||||
"""
|
||||
解析消息内容,返回字典,注意以下约定值:
|
||||
|
@@ -1,5 +1,5 @@
|
||||
from pathlib import Path
|
||||
from typing import Optional, List
|
||||
from typing import Optional
|
||||
from typing import Union
|
||||
|
||||
from app.chain import ChainBase
|
||||
@@ -12,7 +12,6 @@ from app.core.context import MediaInfo
|
||||
from app.core.metainfo import MetaInfo
|
||||
from app.helper.rss import RssHelper
|
||||
from app.log import logger
|
||||
from app.schemas import MediaType
|
||||
|
||||
|
||||
class DoubanChain(ChainBase):
|
||||
@@ -51,28 +50,6 @@ class DoubanChain(ChainBase):
|
||||
mediainfo.set_douban_info(doubaninfo)
|
||||
return Context(meta=meta, mediainfo=mediainfo)
|
||||
|
||||
def douban_movies(self, sort: str, tags: str, start: int = 0, count: int = 30) -> List[MediaInfo]:
|
||||
"""
|
||||
浏览豆瓣电影列表
|
||||
"""
|
||||
logger.info(f'开始获取豆瓣电影列表,排序:{sort},标签:{tags}')
|
||||
movies = self.douban_discover(mtype=MediaType.MOVIE, sort=sort, tags=tags, start=start, count=count)
|
||||
if not movies:
|
||||
logger.warn(f'豆瓣电影列表为空,排序:{sort},标签:{tags}')
|
||||
return []
|
||||
return [MediaInfo(douban_info=movie) for movie in movies]
|
||||
|
||||
def douban_tvs(self, sort: str, tags: str, start: int = 0, count: int = 30) -> List[MediaInfo]:
|
||||
"""
|
||||
浏览豆瓣剧集列表
|
||||
"""
|
||||
logger.info(f'开始获取豆瓣剧集列表,排序:{sort},标签:{tags}')
|
||||
tvs = self.douban_discover(mtype=MediaType.TV, sort=sort, tags=tags, start=start, count=count)
|
||||
if not tvs:
|
||||
logger.warn(f'豆瓣剧集列表为空,排序:{sort},标签:{tags}')
|
||||
return []
|
||||
return [MediaInfo(douban_info=tv) for tv in tvs]
|
||||
|
||||
def remote_sync(self, userid: Union[int, str]):
|
||||
"""
|
||||
同步豆瓣想看数据,发送消息
|
||||
|
@@ -1,41 +1,8 @@
|
||||
from typing import List
|
||||
|
||||
from app.chain import ChainBase
|
||||
from app.core.context import MediaInfo
|
||||
from app.log import logger
|
||||
from app.schemas import MediaType
|
||||
|
||||
|
||||
class TmdbChain(ChainBase):
|
||||
|
||||
def tmdb_movies(self, sort_by: str, with_genres: str, with_original_language: str,
|
||||
page: int = 1) -> List[MediaInfo]:
|
||||
"""
|
||||
浏览TMDB电影信息
|
||||
"""
|
||||
logger.info(f'开始获取TMDB电影列表,排序:{sort_by},类型:{with_genres},语言:{with_original_language}')
|
||||
movies = self.tmdb_discover(mtype=MediaType.MOVIE,
|
||||
sort_by=sort_by,
|
||||
with_genres=with_genres,
|
||||
with_original_language=with_original_language,
|
||||
page=page)
|
||||
if not movies:
|
||||
logger.warn(f'TMDB电影列表为空,排序:{sort_by},类型:{with_genres},语言:{with_original_language}')
|
||||
return []
|
||||
return [MediaInfo(tmdb_info=movie) for movie in movies]
|
||||
|
||||
def tmdb_tvs(self, sort_by: str, with_genres: str, with_original_language: str,
|
||||
page: int = 1) -> List[MediaInfo]:
|
||||
"""
|
||||
浏览TMDB剧集信息
|
||||
"""
|
||||
logger.info(f'开始获取TMDB剧集列表,排序:{sort_by},类型:{with_genres},语言:{with_original_language}')
|
||||
tvs = self.tmdb_discover(mtype=MediaType.TV,
|
||||
sort_by=sort_by,
|
||||
with_genres=with_genres,
|
||||
with_original_language=with_original_language,
|
||||
page=page)
|
||||
if not tvs:
|
||||
logger.warn(f'TMDB剧集列表为空,排序:{sort_by},类型:{with_genres},语言:{with_original_language}')
|
||||
return []
|
||||
return [MediaInfo(tmdb_info=tv) for tv in tvs]
|
||||
"""
|
||||
TheMovieDB处理链
|
||||
"""
|
||||
pass
|
||||
|
Reference in New Issue
Block a user