diff --git a/rip/config.toml b/rip/config.toml index 0eac83a..e4fe567 100644 --- a/rip/config.toml +++ b/rip/config.toml @@ -3,10 +3,16 @@ 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. -concurrent = false +enabled = 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 [qobuz] # 1: 320kbps MP3, 2: 16/44.1, 3: 24/<=96, 4: 24/>=96 diff --git a/rip/core.py b/rip/core.py index 15326da..57a1ade 100644 --- a/rip/core.py +++ b/rip/core.py @@ -218,6 +218,7 @@ class RipCore(list): artwork, conversion, filepaths = tuple( session[key] for key in ("artwork", "conversion", "filepaths") ) + concurrency = session["downloads"]["concurrency"] return { "parent_folder": session["downloads"]["folder"], "folder_format": filepaths["folder_format"], @@ -228,7 +229,8 @@ class RipCore(list): "set_playlist_to_album": session["metadata"]["set_playlist_to_album"], "stay_temp": conversion["enabled"], "conversion": conversion, - "concurrent_downloads": session["downloads"]["concurrent"], + "concurrent_downloads": concurrency["enabled"], + "max_connections": concurrency["max_connections"], "new_tracknumbers": session["metadata"]["new_playlist_tracknumbers"], "download_videos": session["tidal"]["download_videos"], "download_booklets": session["qobuz"]["download_booklets"], diff --git a/streamrip/media.py b/streamrip/media.py index 6bf273c..471f2c3 100644 --- a/streamrip/media.py +++ b/streamrip/media.py @@ -1034,7 +1034,9 @@ class Tracklist(list): # TODO: make this function return the items that have not been downloaded failed_downloads: List[Tuple[str, str, str]] = [] if kwargs.get("concurrent_downloads", True): - with concurrent.futures.ThreadPoolExecutor(15) as executor: + with concurrent.futures.ThreadPoolExecutor( + kwargs.get("max_connections", 3) + ) as executor: future_map = { executor.submit(target, item, **kwargs): item for item in self }