MoviePilot/app/modules/__init__.py
2023-06-19 11:17:29 +08:00

33 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from abc import abstractmethod, ABCMeta
from typing import Tuple, Union
class _ModuleBase(metaclass=ABCMeta):
"""
模块基类实现对应方法在有需要时会被自动调用返回None代表不启用该模块将继续执行下一模块
输入参数与输出参数一致的,或没有输出的,可以被多个模块重复实现
"""
@abstractmethod
def init_module(self) -> None:
"""
模块初始化
"""
pass
@abstractmethod
def init_setting(self) -> Tuple[str, Union[str, bool]]:
"""
模块开关设置返回开关名和开关值开关值为True时代表有值即打开不实现该方法或返回None代表不使用开关
部分模块支持同时开启多个,此时设置项以,分隔开关值使用in判断
"""
pass
@abstractmethod
def stop(self) -> None:
"""
如果关闭时模块有服务需要停止,需要实现此方法
:return: None该方法可被多个模块同时处理
"""
pass