0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 21:53:54 +01:00
This commit is contained in:
KubaPro010
2025-11-08 21:45:08 +01:00
parent ad448d1bed
commit 40dacf5a51

View File

@@ -248,30 +248,30 @@ def main():
module.__dict__['_log_file'] = log_file module.__dict__['_log_file'] = log_file
modules.append((spec, module, module_name)) modules.append((spec, module, module_name))
for (spec, module, module_name) in modules: 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:
traceback.print_exc() traceback.print_exc()
logger.error(f"Failed loading {module_name} due to {e}") logger.error(f"Failed loading {module_name} due to {e}")
continue continue
if md := getattr(module, "module", None): if md := getattr(module, "module", None):
if isinstance(md, list): simple_modules.extend(md) if isinstance(md, list): simple_modules.extend(md)
else: simple_modules.append(md) else: simple_modules.append(md)
if md := getattr(module, "playlistmod", None): if md := getattr(module, "playlistmod", None):
if isinstance(md, tuple): if isinstance(md, tuple):
md, index = md md, index = md
if isinstance(md, list): playlist_modifier_modules[index:index] = md if isinstance(md, list): playlist_modifier_modules[index:index] = md
else: playlist_modifier_modules.insert(index, md) else: playlist_modifier_modules.insert(index, md)
elif isinstance(md, list): playlist_modifier_modules.extend(md) elif isinstance(md, list): playlist_modifier_modules.extend(md)
else: playlist_modifier_modules.append(md) else: playlist_modifier_modules.append(md)
if md := getattr(module, "advisor", None): if md := getattr(module, "advisor", None):
if playlist_advisor: raise Exception("Multiple playlist advisors") if playlist_advisor: raise Exception("Multiple playlist advisors")
playlist_advisor = md playlist_advisor = md
if md := getattr(module, "activemod", None): if md := getattr(module, "activemod", None):
if active_modifier: raise Exception("Multiple active modifiers") if active_modifier: raise Exception("Multiple active modifiers")
active_modifier = md active_modifier = md
if not playlist_advisor: if not playlist_advisor:
logger.critical_error("Playlist advisor was not found") logger.critical_error("Playlist advisor was not found")