From 071855d507e30b12eac60b7f29c4fc31ff9aecf1 Mon Sep 17 00:00:00 2001 From: Jules-WinnfieldX Date: Tue, 5 Dec 2023 17:59:37 -0700 Subject: [PATCH] Fix download delay not being used, bunkrr rate limiter not being used. --- cyberdrop_dl/__init__.py | 2 +- cyberdrop_dl/clients/download_client.py | 2 ++ cyberdrop_dl/managers/client_manager.py | 2 +- cyberdrop_dl/ui/prompts/settings_global_prompts.py | 6 +++--- pyproject.toml | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py index f41e335b7..d4657b896 100644 --- a/cyberdrop_dl/__init__.py +++ b/cyberdrop_dl/__init__.py @@ -1 +1 @@ -__version__ = "5.0.48" +__version__ = "5.0.49" diff --git a/cyberdrop_dl/clients/download_client.py b/cyberdrop_dl/clients/download_client.py index 408ac2cd4..c9c80560a 100644 --- a/cyberdrop_dl/clients/download_client.py +++ b/cyberdrop_dl/clients/download_client.py @@ -74,6 +74,8 @@ async def _download(self, domain: str, manager: Manager, media_item: MediaItem, headers['Referer'] = str(media_item.referer) headers.update(headers_inc) + await asyncio.sleep(self.client_manager.download_delay) + async with client_session.get(media_item.url, headers=headers, ssl=self.client_manager.ssl_context, proxy=self.client_manager.proxy) as resp: await self.client_manager.check_http_status(resp.status, resp.headers, resp.url, download=True) diff --git a/cyberdrop_dl/managers/client_manager.py b/cyberdrop_dl/managers/client_manager.py index adbb423d7..1498c16b0 100644 --- a/cyberdrop_dl/managers/client_manager.py +++ b/cyberdrop_dl/managers/client_manager.py @@ -38,7 +38,7 @@ def __init__(self, manager: Manager): self.proxy = manager.config_manager.global_settings_data['General']['proxy'] self.domain_rate_limits = { - "bunkr": AsyncLimiter(5, 1), + "bunkrr": AsyncLimiter(5, 1), "cyberdrop": AsyncLimiter(10, 1), "pixeldrain": AsyncLimiter(10, 1), "other": AsyncLimiter(25, 1) diff --git a/cyberdrop_dl/ui/prompts/settings_global_prompts.py b/cyberdrop_dl/ui/prompts/settings_global_prompts.py index da6000bae..ec67ebede 100644 --- a/cyberdrop_dl/ui/prompts/settings_global_prompts.py +++ b/cyberdrop_dl/ui/prompts/settings_global_prompts.py @@ -118,8 +118,8 @@ def edit_rate_limiting_settings_prompt(manager: Manager) -> None: ).execute() throttle = inquirer.number( message="Delay between requests during the download stage:", - default=int(manager.config_manager.global_settings_data['Rate_Limiting_Options']['download_delay']), - float_allowed=False, + default=float(manager.config_manager.global_settings_data['Rate_Limiting_Options']['download_delay']), + float_allowed=True, ).execute() max_simultaneous_downloads = inquirer.number( @@ -137,6 +137,6 @@ def edit_rate_limiting_settings_prompt(manager: Manager) -> None: manager.config_manager.global_settings_data['Rate_Limiting_Options']['read_timeout'] = int(read_timeout) manager.config_manager.global_settings_data['Rate_Limiting_Options']['download_attempts'] = int(download_attempts) manager.config_manager.global_settings_data['Rate_Limiting_Options']['rate_limit'] = int(rate_limit) - manager.config_manager.global_settings_data['Rate_Limiting_Options']['download_delay'] = int(throttle) + manager.config_manager.global_settings_data['Rate_Limiting_Options']['download_delay'] = float(throttle) manager.config_manager.global_settings_data['Rate_Limiting_Options']['max_simultaneous_downloads'] = int(max_simultaneous_downloads) manager.config_manager.global_settings_data['Rate_Limiting_Options']['max_simultaneous_downloads_per_domain'] = int(max_simultaneous_downloads_per_domain) diff --git a/pyproject.toml b/pyproject.toml index 171e6d0bd..adc343b21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cyberdrop-dl" -version = "5.0.48" +version = "5.0.49" description = "Bulk downloader for multiple file hosts" authors = ["Jules Winnfield "] readme = "README.md"