Initial commit

This commit is contained in:
mrsobakin 2023-09-08 14:40:37 +03:00
commit ee3c2358ff
12 changed files with 622 additions and 0 deletions

20
lyrics_dl/config.py Normal file
View file

@ -0,0 +1,20 @@
from typing import Self
import tomllib
from dataclasses import dataclass, field
from pathlib import Path
@dataclass
class LyricsDlConfig:
order: list[str] = field(default_factory=lambda: ["kugou", "youtube"])
providers_configs: dict[str, dict] = field(default_factory=lambda: {})
@classmethod
def from_file(cls, path: Path) -> Self:
with open(path, "rb") as f:
config = tomllib.load(f)
return cls(
order=config["providers"].pop("order"),
providers_configs=config["providers"],
)