From a2e927918983575cdbe3fb375bd79c18c02843c8 Mon Sep 17 00:00:00 2001 From: Nathan Thomas Date: Thu, 21 Sep 2023 10:50:43 -0700 Subject: [PATCH] Update config --- rip/config.py | 11 ++++++++++- rip/config.toml | 31 +++++++++++++++++-------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/rip/config.py b/rip/config.py index 076fb4e..d47da09 100644 --- a/rip/config.py +++ b/rip/config.py @@ -182,6 +182,7 @@ class DownloadsConfig: # If you have very fast internet, you will benefit from a higher value, # A value that is too high for your bandwidth may cause slowdowns max_connections: int + requests_per_minute: int @dataclass(slots=True) @@ -205,6 +206,7 @@ class Config: qobuz: QobuzConfig tidal: TidalConfig + deezer: DeezerConfig soundcloud: SoundcloudConfig youtube: YoutubeConfig lastfm: LastFmConfig @@ -217,6 +219,8 @@ class Config: theme: ThemeConfig database: DatabaseConfig + _modified: bool = False + @classmethod def from_toml(cls, toml_str: str): # TODO: handle the mistake where Windows people forget to escape backslash @@ -227,6 +231,7 @@ class Config: downloads = DownloadsConfig(**toml["downloads"]) # type: ignore qobuz = QobuzConfig(**toml["qobuz"]) # type: ignore tidal = TidalConfig(**toml["tidal"]) # type: ignore + deezer = DeezerConfig(**toml["deezer"]) # type: ignore soundcloud = SoundcloudConfig(**toml["soundcloud"]) # type: ignore youtube = YoutubeConfig(**toml["youtube"]) # type: ignore lastfm = LastFmConfig(**toml["lastfm"]) # type: ignore @@ -241,6 +246,7 @@ class Config: downloads=downloads, qobuz=qobuz, tidal=tidal, + deezer=deezer, soundcloud=soundcloud, youtube=youtube, lastfm=lastfm, @@ -253,6 +259,9 @@ class Config: ) @classmethod - def from_defaults(cls): + def defaults(cls): with open(DEFAULT_CONFIG_PATH) as f: return cls.from_toml(f.read()) + + def set_modified(self): + self._modified = True diff --git a/rip/config.toml b/rip/config.toml index 7549e7b..f857cee 100644 --- a/rip/config.toml +++ b/rip/config.toml @@ -4,15 +4,17 @@ folder = "" # Put Qobuz albums in a 'Qobuz' folder, Tidal albums in 'Tidal' etc. source_subdirectories = false -[downloads.concurrency] # Download (and convert) tracks all at once, instead of sequentially. # If you are converting the tracks, or have fast internet, this will # substantially improve processing speed. -enabled = true +concurrency = true # The maximum number of tracks to download at once # If you have very fast internet, you will benefit from a higher value, # A value that is too high for your bandwidth may cause slowdowns max_connections = 3 +# Max number of API requests to handle per minute +# Set to -1 for no limit +requests_per_minute = -1 [qobuz] # 1: 320kbps MP3, 2: 16/44.1, 3: 24/<=96, 4: 24/>=96 @@ -20,9 +22,12 @@ quality = 3 # This will download booklet pdfs that are included with some albums download_booklets = true -email = "" -# This is an md5 hash of the plaintext password -password = "" +# Authenticate to Qobuz using auth token? Value can be true/false only +use_auth_token = false +# Enter your userid if the above use_auth_token is set to true, else enter your email +email_or_userid = "" +# Enter your auth token if the above use_auth_token is set to true, else enter the md5 hash of your plaintext password +password_or_token = "" # Do not change app_id = "" # Do not change @@ -76,15 +81,14 @@ download_videos = false video_downloads_folder = "" # This stores a list of item IDs so that repeats are not downloaded. -[database.downloads] -enabled = true -path = "" +[database] +downloads_enabled = true +downloads_path = "" # If a download fails, the item ID is stored here. Then, `rip repair` can be # called to retry the downloads -[database.failed_downloads] -enabled = true -path = "" +failed_downloads_enabled = true +failed_downloads_path = "" # Convert tracks to a codec after downloading them. [conversion] @@ -101,7 +105,7 @@ bit_depth = 24 lossy_bitrate = 320 # Filter a Qobuz artist's discography. Set to 'true' to turn on a filter. -[filters] +[qobuz_filters] # Remove Collectors Editions, live recordings, etc. extras = false # Picks the highest quality out of albums with identical titles. @@ -157,7 +161,6 @@ restrict_characters = false # Setting this to false may cause downloads to fail on some systems truncate = true - # Last.fm playlists are downloaded by searching for the titles of the tracks [lastfm] # The source on which to search for the tracks. @@ -172,4 +175,4 @@ progress_bar = "dainty" [misc] # Metadata to identify this config file. Do not change. -version = "1.9.6" +version = "2.0"