diff options
| author | Robert Honz <exislow+github@gmail.com> | 2024-01-14 23:09:43 +0100 |
|---|---|---|
| committer | Robert Honz <exislow+github@gmail.com> | 2024-01-14 23:09:43 +0100 |
| commit | ec728d4dcd4741d307cf3c052c1b9ba3d4a7eb92 (patch) | |
| tree | 74ed3d5c341392a703d984a4e052ddb62e153ca6 /tidal_dl_ng/config.py | |
| parent | affaae101e67fd2ee1aebc04b2ea1b551fe05d2f (diff) | |
| download | tidal-dl-ng-ec728d4dcd4741d307cf3c052c1b9ba3d4a7eb92.tar.gz | |
♻️ Refactored `download` for CLI.
Diffstat (limited to 'tidal_dl_ng/config.py')
| -rw-r--r-- | tidal_dl_ng/config.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tidal_dl_ng/config.py b/tidal_dl_ng/config.py index 3c5bebe..2fed1ce 100644 --- a/tidal_dl_ng/config.py +++ b/tidal_dl_ng/config.py @@ -8,7 +8,7 @@ import tidalapi from requests import HTTPError from tidal_dl_ng.helper.decorator import SingletonMeta -from tidal_dl_ng.helper.path import path_file_settings, path_file_token +from tidal_dl_ng.helper.path import path_base, path_file_settings, path_file_token from tidal_dl_ng.model.cfg import Settings as ModelSettings from tidal_dl_ng.model.cfg import Token as ModelToken @@ -17,10 +17,14 @@ class BaseConfig: data: ModelSettings | ModelToken = None file_path: str = None cls_model: object = None + path_base: str = path_base() def save(self) -> None: data_json = self.data.to_json() + # Try to create the base folder. + os.makedirs(self.path_base, exist_ok=True) + with open(self.file_path, encoding="utf-8", mode="w") as f: f.write(data_json) @@ -79,8 +83,8 @@ class Tidal(BaseConfig, metaclass=SingletonMeta): def __init__(self, settings: Settings = None): self.session = tidalapi.Session() - self.session.config.client_id = "6BDSRdpK9hqEBTgU" - self.session.config.client_secret = "xeuPmY7nbpZ9IIbLAcQ93shka1VNheUAqN6IcszjTG8=" + # self.session.config.client_id = "km8T1xS355y7dd3H" + # self.session.config.client_secret = "vcmeGW1OuZ0fWYMCSZ6vNvSLJlT3XEpW0ambgYt5ZuI=" self.session.video_quality = tidalapi.VideoQuality.high self.file_path = path_file_token() self.token_from_storage = self.read(self.file_path) |
