fix: config loading

This commit is contained in:
mrsobakin 2025-03-29 18:31:21 +03:00
parent efacf0c2e5
commit 9c8e3ab3e2
No known key found for this signature in database
GPG key ID: 325CBF665E4FFD6E

View file

@ -31,10 +31,17 @@ class LyricsDlConfig:
with open(path, "rb") as f:
config = tomllib.load(f)
return cls(
order=config["providers"].pop("order"),
providers_configs=config["providers"],
)
cfg = {
"order": config["providers"].pop("order", None),
"delay": config["providers"].pop("delay", None),
"prepend_header": config["providers"].pop("prepend_header", None),
"providers_configs": config.get("providers"),
}
# Remove unset keys
cfg = {k: v for k, v in cfg.items() if v is not None}
return cls(**cfg)
@classmethod
def default(cls) -> Self: