diff --git a/modules/auto-schedule/index.py b/deprecated/auto-schedule/index.py similarity index 100% rename from modules/auto-schedule/index.py rename to deprecated/auto-schedule/index.py diff --git a/modules/auto-schedule/meta.json b/deprecated/auto-schedule/meta.json similarity index 100% rename from modules/auto-schedule/meta.json rename to deprecated/auto-schedule/meta.json diff --git a/modules/auto-schedule/predefine.py b/deprecated/auto-schedule/predefine.py similarity index 100% rename from modules/auto-schedule/predefine.py rename to deprecated/auto-schedule/predefine.py diff --git a/modules/auto-schedule/schedule.json b/deprecated/auto-schedule/schedule.json similarity index 100% rename from modules/auto-schedule/schedule.json rename to deprecated/auto-schedule/schedule.json diff --git a/main.py b/main.py index 84f6d20..8fe41ea 100644 --- a/main.py +++ b/main.py @@ -57,13 +57,13 @@ class ModuleV1: return "" class ModuleV2: - def __init__(self, path, index_file, enabled, alias): + def __init__(self, path, module_file, enabled, alias): self.version = 2 self.enabled = enabled self.alias = alias self.path = path - self.index_file = index_file[:-3] - self.obj = importlib.import_module((path + self.index_file).replace("/", ".")) + self.module_file = module_file[:-3] + self.obj = importlib.import_module((path + self.module_file).replace("/", ".")) # running the module def process(self, msg): @@ -94,12 +94,12 @@ class ModuleControlUnit: meta = json.loads( meta_raw ) if "version" in meta: if meta["version"] == 1: - if "index_file" in meta: - index_file = meta["index_file"] + if "module_file" in meta: + module_file = meta["module_file"] else: - index_file = "index.py" + module_file = "main.py" - code = readfile( "modules/{}/{}".format(folder, index_file) ) + code = readfile( "modules/{}/{}".format(folder, module_file) ) if not code: # False both when readfile() returns False and when the code string is empty print("[WARN] reload_modules: module {} does not have any code, skipping...".format(folder)) continue @@ -124,10 +124,10 @@ class ModuleControlUnit: print("[INFO] reload_modules: successfully loaded {} as {} (start_on_boot: {})".format(folder, alias, enabled)) elif meta["version"] == 2: - if "index_file" in meta: - index_file = meta["index_file"] + if "module_file" in meta: + module_file = meta["module_file"] else: - index_file = "index.py" + module_file = "main.py" if "start_on_boot" in meta: enabled = meta["start_on_boot"] @@ -139,7 +139,7 @@ class ModuleControlUnit: else: alias = None - self.modules.append(ModuleV2(f"modules/{folder}/", index_file, enabled, alias)) + self.modules.append(ModuleV2(f"modules/{folder}/", module_file, enabled, alias)) print(f"[INFO] reload_modules: successfully loaded {folder} as {alias} (start_on_boot: {enabled})") diff --git a/modules/auto-schedule-pro/index.py b/modules/auto-schedule-pro/main.py similarity index 97% rename from modules/auto-schedule-pro/index.py rename to modules/auto-schedule-pro/main.py index 542e781..9fa48ec 100644 --- a/modules/auto-schedule-pro/index.py +++ b/modules/auto-schedule-pro/main.py @@ -48,11 +48,12 @@ if self.MESSAGE["text"].lower() == "!пара": print("test2") if next_lesson_time == None: + actual_lesson_ts = reference_time + min(full_schedule.keys()) + dt_lesson = datetime.datetime.fromtimestamp(actual_lesson_ts) + dt_lesson_finish = datetime.datetime.fromtimestamp(actual_lesson_ts + 5400) + if len(full_schedule.keys()) > 0: print("test3.1") - actual_lesson_ts = reference_time + min(full_schedule.keys()) - dt_lesson = datetime.datetime.fromtimestamp(actual_lesson_ts) - dt_lesson_finish = datetime.datetime.fromtimestamp(actual_lesson_ts + 5400) p = full_schedule[min(full_schedule.keys())] print("test3.1.1") diff --git a/modules/auto-schedule-pro/meta.json b/modules/auto-schedule-pro/meta.json index 732f1ea..6bf4b67 100644 --- a/modules/auto-schedule-pro/meta.json +++ b/modules/auto-schedule-pro/meta.json @@ -1,7 +1,7 @@ { + "version": 2, + "index_file": "main.py", "start_on_boot": true, "alias": "auto-schedule-pro", - "version": 1, - "index_file": "index.py", "predefine": "predefine.py" -} +} \ No newline at end of file diff --git a/modules/echo-v1.0/index.py b/modules/echo-v1.0/main.py similarity index 100% rename from modules/echo-v1.0/index.py rename to modules/echo-v1.0/main.py diff --git a/modules/echo-v1.0/meta.json b/modules/echo-v1.0/meta.json index c489c9b..741274d 100644 --- a/modules/echo-v1.0/meta.json +++ b/modules/echo-v1.0/meta.json @@ -1,5 +1,5 @@ { - "version": 1, - "index_file": "index.py", + "version": 2, + "index_file": "main.py", "start_on_boot": false -} +} \ No newline at end of file diff --git a/modules/irc-bridge/index.py b/modules/irc-bridge/main.py similarity index 100% rename from modules/irc-bridge/index.py rename to modules/irc-bridge/main.py diff --git a/modules/irc-bridge/meta.json b/modules/irc-bridge/meta.json index 0309cdc..4402e8d 100644 --- a/modules/irc-bridge/meta.json +++ b/modules/irc-bridge/meta.json @@ -1,7 +1,7 @@ { "start_on_boot": true, "alias": "irc-bridge", - "version": 1, - "index_file": "index.py", + "version": 2, + "index_file": "main.py", "predefine": "predefine.py" } diff --git a/modules/mass-tagger/index.py b/modules/mass-tagger/main.py similarity index 100% rename from modules/mass-tagger/index.py rename to modules/mass-tagger/main.py diff --git a/modules/mass-tagger/meta.json b/modules/mass-tagger/meta.json index f27d2a4..5739566 100644 --- a/modules/mass-tagger/meta.json +++ b/modules/mass-tagger/meta.json @@ -1,6 +1,6 @@ { - "version": 1, - "index_file": "index.py", + "version": 2, + "index_file": "main.py", "predefine": "predefine.py", "start_on_boot": true, "alias": "mass-tagger" diff --git a/modules/qna-basic/index.py b/modules/qna-basic/main.py similarity index 100% rename from modules/qna-basic/index.py rename to modules/qna-basic/main.py diff --git a/modules/qna-basic/meta.json b/modules/qna-basic/meta.json index 73757df..30ca09b 100644 --- a/modules/qna-basic/meta.json +++ b/modules/qna-basic/meta.json @@ -1,6 +1,6 @@ { - "version": 1, - "index_file": "index.py", + "version": 2, + "index_file": "main.py", "start_on_boot": true, "alias": "qna-basic" } diff --git a/modules/transliteration-decoder/index.py b/modules/transliteration-decoder/main.py similarity index 100% rename from modules/transliteration-decoder/index.py rename to modules/transliteration-decoder/main.py diff --git a/modules/transliteration-decoder/meta.json b/modules/transliteration-decoder/meta.json index 94db3ee..b1f6517 100644 --- a/modules/transliteration-decoder/meta.json +++ b/modules/transliteration-decoder/meta.json @@ -1,7 +1,7 @@ { - "version": 1, - "index_file": "index.py", + "version": 2, + "index_file": "main.py", "start_on_boot": true, "alias": "translit-decoder", "predefine": "predefine.py" -} +} \ No newline at end of file