mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-07-13 00:13:02 +08:00
feat(module): add ServiceBaseHelper for service and instance
This commit is contained in:
@@ -90,6 +90,14 @@ class ServiceBase(Generic[TService, TConf], metaclass=ABCMeta):
|
||||
# 如果传入的是工厂函数,直接调用工厂函数
|
||||
self._instances[conf.name] = service_type(conf)
|
||||
|
||||
def get_instances(self) -> Dict[str, TService]:
|
||||
"""
|
||||
获取服务实例列表
|
||||
|
||||
:return: 返回服务实例列表
|
||||
"""
|
||||
return self._instances
|
||||
|
||||
def get_instance(self, name: str) -> Optional[TService]:
|
||||
"""
|
||||
获取服务实例
|
||||
|
||||
Reference in New Issue
Block a user