You've already forked RadioPlayer
mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-02-27 06:03:52 +01:00
prepare then execute
This commit is contained in:
@@ -225,6 +225,7 @@ def play_playlist(playlist_path: Path, starting_index: int = 0):
|
|||||||
def main():
|
def main():
|
||||||
logger.info("Core is starting, loading modules")
|
logger.info("Core is starting, loading modules")
|
||||||
global playlist_advisor, active_modifier
|
global playlist_advisor, active_modifier
|
||||||
|
modules: list[tuple] = []
|
||||||
for file in MODULES_DIR.glob("*"):
|
for file in MODULES_DIR.glob("*"):
|
||||||
if file.name.endswith(".py") and file.name != "__init__.py":
|
if file.name.endswith(".py") and file.name != "__init__.py":
|
||||||
module_name = file.name[:-3]
|
module_name = file.name[:-3]
|
||||||
@@ -245,7 +246,9 @@ def main():
|
|||||||
|
|
||||||
module._log_file = log_file # type: ignore
|
module._log_file = log_file # type: ignore
|
||||||
module.__dict__['_log_file'] = log_file
|
module.__dict__['_log_file'] = log_file
|
||||||
|
modules.append((spec, module, module_name))
|
||||||
|
|
||||||
|
for (spec, module, module_name) in modules:
|
||||||
if not spec.loader: continue
|
if not spec.loader: continue
|
||||||
try: spec.loader.exec_module(module)
|
try: spec.loader.exec_module(module)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user