fix
This commit is contained in:
@ -68,6 +68,14 @@ class _ModuleBase(metaclass=ABCMeta):
|
||||
"""
|
||||
pass
|
||||
|
||||
def tvdb_info(self, tvdbid: int) -> Optional[dict]:
|
||||
"""
|
||||
获取TVDB信息
|
||||
:param tvdbid: int
|
||||
:return: 识别的媒体信息,包括剧集信息
|
||||
"""
|
||||
pass
|
||||
|
||||
def message_parser(self, body: Any, form: Any, args: Any) -> Optional[dict]:
|
||||
"""
|
||||
解析消息内容,返回字典,注意以下约定值:
|
||||
|
@ -37,6 +37,7 @@ class DoubanModule(_ModuleBase):
|
||||
"""
|
||||
if not doubanid:
|
||||
return None
|
||||
logger.info(f"开始获取豆瓣信息:{doubanid} ...")
|
||||
douban_info = self.doubanapi.movie_detail(doubanid)
|
||||
if douban_info:
|
||||
celebrities = self.doubanapi.movie_celebrities(doubanid)
|
||||
|
33
app/modules/thetvdb/__init__.py
Normal file
33
app/modules/thetvdb/__init__.py
Normal file
@ -0,0 +1,33 @@
|
||||
from typing import Optional, Tuple, Union
|
||||
|
||||
import tvdb_api
|
||||
|
||||
from app.core.config import settings
|
||||
from app.log import logger
|
||||
from app.modules import _ModuleBase
|
||||
|
||||
|
||||
class TheTvDbModule(_ModuleBase):
|
||||
|
||||
tvdb: tvdb_api.Tvdb = None
|
||||
|
||||
def init_module(self) -> None:
|
||||
self.tvdb = tvdb_api.Tvdb(apikey=settings.TVDB_API_KEY)
|
||||
|
||||
def stop(self):
|
||||
pass
|
||||
|
||||
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
||||
pass
|
||||
|
||||
def tvdb_info(self, tvdbid: int) -> Optional[dict]:
|
||||
"""
|
||||
获取TVDB信息
|
||||
:param tvdbid: int
|
||||
:return: 识别的媒体信息,包括剧集信息
|
||||
"""
|
||||
try:
|
||||
logger.info(f"开始获取TVDB信息: {tvdbid} ...")
|
||||
return self.tvdb[tvdbid].data
|
||||
except Exception as err:
|
||||
logger.error(f"获取TVDB信息失败: {err}")
|
Reference in New Issue
Block a user