Merge branch 'dev' of https://github.com/jxxghp/MoviePilot into feature/security

This commit is contained in:
InfinityPacer
2024-10-13 00:13:35 +08:00
51 changed files with 409 additions and 279 deletions

View File

@@ -5,7 +5,7 @@ from app.core.config import settings
from app.core.event import eventmanager
from app.helper.module import ModuleHelper
from app.log import logger
from app.schemas.types import EventType
from app.schemas.types import EventType, ModuleType
from app.utils.object import ObjectUtils
from app.utils.singleton import Singleton
@@ -124,6 +124,17 @@ class ModuleManager(metaclass=Singleton):
and ObjectUtils.check_method(getattr(module, method)):
yield module
def get_running_type_modules(self, module_type: ModuleType) -> Generator:
"""
获取指定类型的模块列表
"""
if not self._running_modules:
return []
for _, module in self._running_modules.items():
if hasattr(module, 'get_type') \
and module.get_type() == module_type:
yield module
def get_module(self, module_id: str) -> Any:
"""
根据模块id获取模块