fix 多通知Bug
This commit is contained in:
parent
0cc104ef11
commit
b831d71bf7
@ -11,8 +11,6 @@ from app.core.context import MediaInfo, Context, TorrentInfo
|
|||||||
from app.core.metainfo import MetaInfo
|
from app.core.metainfo import MetaInfo
|
||||||
from app.core.security import verify_token
|
from app.core.security import verify_token
|
||||||
from app.db import get_db
|
from app.db import get_db
|
||||||
from app.db.models.user import User
|
|
||||||
from app.db.userauth import get_current_active_superuser
|
|
||||||
from app.schemas import NotExistMediaInfo, MediaType
|
from app.schemas import NotExistMediaInfo, MediaType
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
@ -97,8 +97,8 @@ class ChainBase(metaclass=ABCMeta):
|
|||||||
if isinstance(temp, list):
|
if isinstance(temp, list):
|
||||||
result.extend(temp)
|
result.extend(temp)
|
||||||
else:
|
else:
|
||||||
# 返回结果非列表也非空,则继续执行下一模块
|
# 中止继续执行
|
||||||
result = func(*args, **kwargs)
|
break
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.error(f"运行模块 {method} 出错:{module.__class__.__name__} - {err}\n{traceback.print_exc()}")
|
logger.error(f"运行模块 {method} 出错:{module.__class__.__name__} - {err}\n{traceback.print_exc()}")
|
||||||
return result
|
return result
|
||||||
@ -345,7 +345,7 @@ class ChainBase(metaclass=ABCMeta):
|
|||||||
return self.run_module("refresh_mediaserver", mediainfo=mediainfo, file_path=file_path)
|
return self.run_module("refresh_mediaserver", mediainfo=mediainfo, file_path=file_path)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def post_message(self, message: Notification) -> Optional[bool]:
|
def post_message(self, message: Notification) -> None:
|
||||||
"""
|
"""
|
||||||
发送消息
|
发送消息
|
||||||
:param message: 消息体
|
:param message: 消息体
|
||||||
@ -364,7 +364,7 @@ class ChainBase(metaclass=ABCMeta):
|
|||||||
f"title={message.title}, "
|
f"title={message.title}, "
|
||||||
f"text={message.text},"
|
f"text={message.text},"
|
||||||
f"userid={message.userid}")
|
f"userid={message.userid}")
|
||||||
return self.run_module("post_message", message=message)
|
self.run_module("post_message", message=message)
|
||||||
|
|
||||||
def post_medias_message(self, message: Notification, medias: List[MediaInfo]) -> Optional[bool]:
|
def post_medias_message(self, message: Notification, medias: List[MediaInfo]) -> Optional[bool]:
|
||||||
"""
|
"""
|
||||||
|
@ -8,9 +8,8 @@ from sqlalchemy.orm import Session
|
|||||||
from app.chain import ChainBase
|
from app.chain import ChainBase
|
||||||
from app.chain.site import SiteChain
|
from app.chain.site import SiteChain
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.db.siteicon_oper import SiteIconOper
|
|
||||||
from app.db.site_oper import SiteOper
|
from app.db.site_oper import SiteOper
|
||||||
from app.helper.browser import PlaywrightHelper
|
from app.db.siteicon_oper import SiteIconOper
|
||||||
from app.helper.cloudflare import under_challenge
|
from app.helper.cloudflare import under_challenge
|
||||||
from app.helper.cookiecloud import CookieCloudHelper
|
from app.helper.cookiecloud import CookieCloudHelper
|
||||||
from app.helper.message import MessageHelper
|
from app.helper.message import MessageHelper
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import time
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Tuple, Optional
|
from typing import Tuple, Optional
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, List
|
from typing import Any
|
||||||
|
|
||||||
from app.db import DbOper
|
from app.db import DbOper
|
||||||
from app.db.models.downloadhistory import DownloadHistory
|
from app.db.models.downloadhistory import DownloadHistory
|
||||||
|
@ -182,14 +182,14 @@ class SlackModule(_ModuleBase):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@checkMessage(MessageChannel.Slack)
|
@checkMessage(MessageChannel.Slack)
|
||||||
def post_message(self, message: Notification) -> Optional[bool]:
|
def post_message(self, message: Notification) -> None:
|
||||||
"""
|
"""
|
||||||
发送消息
|
发送消息
|
||||||
:param message: 消息
|
:param message: 消息
|
||||||
:return: 成功或失败
|
:return: 成功或失败
|
||||||
"""
|
"""
|
||||||
return self.slack.send_msg(title=message.title, text=message.text,
|
self.slack.send_msg(title=message.title, text=message.text,
|
||||||
image=message.image, userid=message.userid)
|
image=message.image, userid=message.userid)
|
||||||
|
|
||||||
@checkMessage(MessageChannel.Slack)
|
@checkMessage(MessageChannel.Slack)
|
||||||
def post_medias_message(self, message: Notification, medias: List[MediaInfo]) -> Optional[bool]:
|
def post_medias_message(self, message: Notification, medias: List[MediaInfo]) -> Optional[bool]:
|
||||||
|
@ -90,14 +90,14 @@ class TelegramModule(_ModuleBase):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@checkMessage(MessageChannel.Telegram)
|
@checkMessage(MessageChannel.Telegram)
|
||||||
def post_message(self, message: Notification) -> Optional[bool]:
|
def post_message(self, message: Notification) -> None:
|
||||||
"""
|
"""
|
||||||
发送消息
|
发送消息
|
||||||
:param message: 消息体
|
:param message: 消息体
|
||||||
:return: 成功或失败
|
:return: 成功或失败
|
||||||
"""
|
"""
|
||||||
return self.telegram.send_msg(title=message.title, text=message.text,
|
self.telegram.send_msg(title=message.title, text=message.text,
|
||||||
image=message.image, userid=message.userid)
|
image=message.image, userid=message.userid)
|
||||||
|
|
||||||
@checkMessage(MessageChannel.Telegram)
|
@checkMessage(MessageChannel.Telegram)
|
||||||
def post_medias_message(self, message: Notification, medias: List[MediaInfo]) -> Optional[bool]:
|
def post_medias_message(self, message: Notification, medias: List[MediaInfo]) -> Optional[bool]:
|
||||||
|
@ -271,11 +271,11 @@ class TmdbScraper:
|
|||||||
# 添加时间
|
# 添加时间
|
||||||
DomUtils.add_node(doc, root, "dateadded", time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))
|
DomUtils.add_node(doc, root, "dateadded", time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))
|
||||||
# TMDBID
|
# TMDBID
|
||||||
uniqueid = DomUtils.add_node(doc, root, "uniqueid", tmdbid)
|
uniqueid = DomUtils.add_node(doc, root, "uniqueid", str(tmdbid))
|
||||||
uniqueid.setAttribute("type", "tmdb")
|
uniqueid.setAttribute("type", "tmdb")
|
||||||
uniqueid.setAttribute("default", "true")
|
uniqueid.setAttribute("default", "true")
|
||||||
# tmdbid
|
# tmdbid
|
||||||
DomUtils.add_node(doc, root, "tmdbid", tmdbid)
|
DomUtils.add_node(doc, root, "tmdbid", str(tmdbid))
|
||||||
# 标题
|
# 标题
|
||||||
DomUtils.add_node(doc, root, "title", episodeinfo.get("name") or "第 %s 集" % episode)
|
DomUtils.add_node(doc, root, "title", episodeinfo.get("name") or "第 %s 集" % episode)
|
||||||
# 简介
|
# 简介
|
||||||
|
@ -114,14 +114,14 @@ class WechatModule(_ModuleBase):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@checkMessage(MessageChannel.Wechat)
|
@checkMessage(MessageChannel.Wechat)
|
||||||
def post_message(self, message: Notification) -> Optional[bool]:
|
def post_message(self, message: Notification) -> None:
|
||||||
"""
|
"""
|
||||||
发送消息
|
发送消息
|
||||||
:param message: 消息内容
|
:param message: 消息内容
|
||||||
:return: 成功或失败
|
:return: 成功或失败
|
||||||
"""
|
"""
|
||||||
return self.wechat.send_msg(title=message.title, text=message.text,
|
self.wechat.send_msg(title=message.title, text=message.text,
|
||||||
image=message.image, userid=message.userid)
|
image=message.image, userid=message.userid)
|
||||||
|
|
||||||
@checkMessage(MessageChannel.Wechat)
|
@checkMessage(MessageChannel.Wechat)
|
||||||
def post_medias_message(self, message: Notification, medias: List[MediaInfo]) -> Optional[bool]:
|
def post_medias_message(self, message: Notification, medias: List[MediaInfo]) -> Optional[bool]:
|
||||||
|
@ -42,7 +42,6 @@ class EventType(Enum):
|
|||||||
NoticeMessage = "notice.message"
|
NoticeMessage = "notice.message"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 系统配置Key字典
|
# 系统配置Key字典
|
||||||
class SystemConfigKey(Enum):
|
class SystemConfigKey(Enum):
|
||||||
# 用户已安装的插件
|
# 用户已安装的插件
|
||||||
|
Loading…
x
Reference in New Issue
Block a user