Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
8d82d0f4fd
@ -1,5 +1,5 @@
|
|||||||
import traceback
|
import traceback
|
||||||
from typing import Generator, Optional, Tuple
|
from typing import Generator, Optional, Tuple, Any
|
||||||
|
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.helper.module import ModuleHelper
|
from app.helper.module import ModuleHelper
|
||||||
@ -97,6 +97,16 @@ class ModuleManager(metaclass=Singleton):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def get_running_module(self, module_id: str) -> Any:
|
||||||
|
"""
|
||||||
|
根据模块id获取模块运行实例
|
||||||
|
"""
|
||||||
|
if not module_id:
|
||||||
|
return None
|
||||||
|
if not self._running_modules:
|
||||||
|
return None
|
||||||
|
return self._running_modules.get(module_id)
|
||||||
|
|
||||||
def get_running_modules(self, method: str) -> Generator:
|
def get_running_modules(self, method: str) -> Generator:
|
||||||
"""
|
"""
|
||||||
获取实现了同一方法的模块列表
|
获取实现了同一方法的模块列表
|
||||||
@ -108,6 +118,16 @@ class ModuleManager(metaclass=Singleton):
|
|||||||
and ObjectUtils.check_method(getattr(module, method)):
|
and ObjectUtils.check_method(getattr(module, method)):
|
||||||
yield module
|
yield module
|
||||||
|
|
||||||
|
def get_module(self, module_id: str) -> Any:
|
||||||
|
"""
|
||||||
|
根据模块id获取模块
|
||||||
|
"""
|
||||||
|
if not module_id:
|
||||||
|
return None
|
||||||
|
if not self._modules:
|
||||||
|
return None
|
||||||
|
return self._modules.get(module_id)
|
||||||
|
|
||||||
def get_modules(self) -> dict:
|
def get_modules(self) -> dict:
|
||||||
"""
|
"""
|
||||||
获取模块列表
|
获取模块列表
|
||||||
|
@ -120,6 +120,8 @@ class NotificationType(Enum):
|
|||||||
MediaServer = "媒体服务器通知"
|
MediaServer = "媒体服务器通知"
|
||||||
# 处理失败需要人工干预
|
# 处理失败需要人工干预
|
||||||
Manual = "手动处理通知"
|
Manual = "手动处理通知"
|
||||||
|
# 插件消息
|
||||||
|
Plugin = "插件消息"
|
||||||
|
|
||||||
|
|
||||||
class MessageChannel(Enum):
|
class MessageChannel(Enum):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user