mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-24 18:40:03 +08:00
修复非str环境变量不起作用的bug
This commit is contained in:
@@ -42,7 +42,7 @@ def run():
|
||||
logger.debug("Please copy `const_dev.py` to `const_dev.py` to use custom settings")
|
||||
settings.init(DEV_SETTINGS)
|
||||
else:
|
||||
init_switch()
|
||||
# init_switch()
|
||||
settings.init()
|
||||
setup_logger()
|
||||
download_client = DownloadClient()
|
||||
|
||||
@@ -25,7 +25,7 @@ class Settings(dict):
|
||||
def _settings_from_env(self):
|
||||
"""Loads settings from env."""
|
||||
return {
|
||||
attr: self._val_from_env(env, attr)
|
||||
attr if isinstance(attr, str) else attr[0]: self._val_from_env(env, attr)
|
||||
for env, attr in const.ENV_TO_ATTR.items()
|
||||
if env in os.environ
|
||||
}
|
||||
|
||||
@@ -22,18 +22,21 @@ DEFAULT_SETTINGS = {
|
||||
|
||||
ENV_TO_ATTR = {
|
||||
"AB_DOWNLOADER_HOST": "host_ip",
|
||||
"AB_INTERVAL_TIME": "sleep_time",
|
||||
"AB_INTERVAL_TIME": ("sleep_time", lambda e: float(e)),
|
||||
"AB_DOWNLOADER_USERNAME": "user_name",
|
||||
"AB_DOWNLOADER_PASSWORD": "password",
|
||||
"AB_RSS": "rss_link",
|
||||
"AB_DOWNLOAD_PATH": "download_path",
|
||||
"AB_METHOD": "method",
|
||||
"AB_GROUP_TAG": "enable_group_tag",
|
||||
"AB_GROUP_TAG": ("enable_group_tag", lambda e: e.lower() in ("true", "1", "t")),
|
||||
"AB_NOT_CONTAIN": "not_contain",
|
||||
"AB_RULE_DEBUG": "get_rule_debug",
|
||||
"AB_DEBUG_MODE": "debug_mode",
|
||||
"AB_EP_COMPLETE": "enable_eps_complete",
|
||||
"AB_SEASON_ONE": "season_one_tag"
|
||||
"AB_RULE_DEBUG": ("get_rule_debug", lambda e: e.lower() in ("true", "1", "t")),
|
||||
"AB_DEBUG_MODE": ("debug_mode", lambda e: e.lower() in ("true", "1", "t")),
|
||||
"AB_EP_COMPLETE": (
|
||||
"enable_eps_complete",
|
||||
lambda e: e.lower() in ("true", "1", "t")
|
||||
),
|
||||
"AB_SEASON_ONE": ("season_one_tag", lambda e: e.lower() in ("true", "1", "t"))
|
||||
}
|
||||
|
||||
FULL_SEASON_SUPPORT_GROUP = ["Lilith-Raws"]
|
||||
|
||||
@@ -19,5 +19,4 @@ def init_switch():
|
||||
|
||||
if __name__ == "__main__":
|
||||
settings.init()
|
||||
settings.sleep_time = float(settings.sleep_time)
|
||||
print(type(settings.sleep_time))
|
||||
print(type(settings.debug_mode))
|
||||
Reference in New Issue
Block a user