2023-02-17 07:02:21 +01:00
|
|
|
from core.config import CoreConfig
|
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
|
|
|
|
class Mai2ServerConfig:
|
2023-02-17 07:02:21 +01:00
|
|
|
def __init__(self, parent: "Mai2Config") -> None:
|
|
|
|
self.__config = parent
|
|
|
|
|
|
|
|
@property
|
|
|
|
def enable(self) -> bool:
|
2023-03-09 17:38:58 +01:00
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "mai2", "server", "enable", default=True
|
|
|
|
)
|
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
@property
|
|
|
|
def loglevel(self) -> int:
|
2023-03-09 17:38:58 +01:00
|
|
|
return CoreConfig.str_to_loglevel(
|
|
|
|
CoreConfig.get_config_field(
|
|
|
|
self.__config, "mai2", "server", "loglevel", default="info"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2023-05-10 08:31:30 +02:00
|
|
|
class Mai2DeliverConfig:
|
|
|
|
def __init__(self, parent: "Mai2Config") -> None:
|
|
|
|
self.__config = parent
|
|
|
|
|
|
|
|
@property
|
|
|
|
def enable(self) -> bool:
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "mai2", "deliver", "enable", default=False
|
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def udbdl_enable(self) -> bool:
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "mai2", "deliver", "udbdl_enable", default=False
|
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def list_folder(self) -> int:
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "mai2", "server", "list_folder", default=""
|
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def list_folder(self) -> int:
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "mai2", "server", "content_folder", default=""
|
|
|
|
)
|
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
|
|
|
|
class Mai2Config(dict):
|
|
|
|
def __init__(self) -> None:
|
2023-03-09 17:38:58 +01:00
|
|
|
self.server = Mai2ServerConfig(self)
|
2023-05-10 08:31:30 +02:00
|
|
|
self.deliver = Mai2DeliverConfig(self)
|