Skip to content

Bulk asynchronous downloader for multiple file hosts

Cast integers complete.

Jules-WinnfieldX1a23434c6909
diff --git a/cyberdrop_dl/ui/prompts/settings_global_prompts.py b/cyberdrop_dl/ui/prompts/settings_global_prompts.py
index 42f0d32e7..be65eab82 100644
--- a/cyberdrop_dl/ui/prompts/settings_global_prompts.py
+++ b/cyberdrop_dl/ui/prompts/settings_global_prompts.py
@@ -69,7 +69,7 @@ def edit_general_settings_prompt(manager: Manager) -> None:
).execute()
required_free_space = inquirer.number(
message="Required Free Space (in GB):",
- default=manager.config_manager.global_settings_data['General']['required_free_space'],
+ default=int(manager.config_manager.global_settings_data['General']['required_free_space']),
float_allowed=False,
validate=NumberValidator("Input should be a number")
).execute()
@@ -77,9 +77,9 @@ def edit_general_settings_prompt(manager: Manager) -> None:
manager.config_manager.global_settings_data['General']['allow_insecure_connections'] = allow_insecure_connections
manager.config_manager.global_settings_data['General']['user_agent'] = user_agent
manager.config_manager.global_settings_data['General']['proxy'] = proxy
- manager.config_manager.global_settings_data['General']['max_filename_length'] = max_filename_length
- manager.config_manager.global_settings_data['General']['max_folder_name_length'] = max_folder_name_length
- manager.config_manager.global_settings_data['General']['required_free_space'] = required_free_space
+ manager.config_manager.global_settings_data['General']['max_filename_length'] = int(max_filename_length)
+ manager.config_manager.global_settings_data['General']['max_folder_name_length'] = int(max_folder_name_length)
+ manager.config_manager.global_settings_data['General']['required_free_space'] = int(required_free_space)
def edit_progress_settings_prompt(manager: Manager) -> None:
@@ -88,12 +88,12 @@ def edit_progress_settings_prompt(manager: Manager) -> None:
console.print("Editing Progress Settings")
refresh_rate = inquirer.number(
message="Refresh Rate:",
- default=manager.config_manager.global_settings_data['Progress_Options']['refresh_rate'],
+ default=int(manager.config_manager.global_settings_data['Progress_Options']['refresh_rate']),
float_allowed=False,
validate=NumberValidator("Input should be a number")
).execute()
- manager.config_manager.global_settings_data['Progress_Options']['refresh_rate'] = refresh_rate
+ manager.config_manager.global_settings_data['Progress_Options']['refresh_rate'] = int(refresh_rate)
def edit_rate_limiting_settings_prompt(manager: Manager) -> None:
@@ -102,50 +102,50 @@ def edit_rate_limiting_settings_prompt(manager: Manager) -> None:
console.print("Editing Rate Limiting Settings")
connection_timeout = inquirer.number(
message="Connection Timeout (in seconds):",
- default=manager.config_manager.global_settings_data['Rate_Limiting_Options']['connection_timeout'],
+ default=int(manager.config_manager.global_settings_data['Rate_Limiting_Options']['connection_timeout']),
float_allowed=True,
validate=NumberValidator("Input should be a number")
).execute()
read_timeout = inquirer.number(
message="Read Timeout (in seconds):",
- default=manager.config_manager.global_settings_data['Rate_Limiting_Options']['read_timeout'],
+ default=int(manager.config_manager.global_settings_data['Rate_Limiting_Options']['read_timeout']),
float_allowed=True,
validate=NumberValidator("Input should be a number")
).execute()
download_attempts = inquirer.number(
message="Download Attempts:",
- default=manager.config_manager.global_settings_data['Rate_Limiting_Options']['download_attempts'],
+ default=int(manager.config_manager.global_settings_data['Rate_Limiting_Options']['download_attempts']),
float_allowed=False,
validate=NumberValidator("Input should be a number")
).execute()
rate_limit = inquirer.number(
message="Maximum number of requests per second:",
- default=manager.config_manager.global_settings_data['Rate_Limiting_Options']['rate_limit'],
+ default=int(manager.config_manager.global_settings_data['Rate_Limiting_Options']['rate_limit']),
float_allowed=False,
validate=NumberValidator("Input should be a number")
).execute()
throttle = inquirer.number(
message="Delay between requests during the download stage:",
- default=manager.config_manager.global_settings_data['Rate_Limiting_Options']['download_delay'],
+ default=int(manager.config_manager.global_settings_data['Rate_Limiting_Options']['download_delay']),
float_allowed=False,
validate=NumberValidator("Input should be a number")
).execute()
max_simultaneous_downloads = inquirer.text(
message="Maximum number of simultaneous downloads:",
- default=manager.config_manager.global_settings_data['Rate_Limiting_Options']['max_simultaneous_downloads'],
+ default=int(manager.config_manager.global_settings_data['Rate_Limiting_Options']['max_simultaneous_downloads']),
validate=NumberValidator("Input should be a number")
).execute()
max_simultaneous_downloads_per_domain = inquirer.text(
message="Maximum number of simultaneous downloads per domain:",
- default=manager.config_manager.global_settings_data['Rate_Limiting_Options']['max_simultaneous_downloads_per_domain'],
+ default=int(manager.config_manager.global_settings_data['Rate_Limiting_Options']['max_simultaneous_downloads_per_domain']),
validate=NumberValidator("Input should be a number")
).execute()
- manager.config_manager.global_settings_data['Rate_Limiting_Options']['connection_timeout'] = connection_timeout
- manager.config_manager.global_settings_data['Rate_Limiting_Options']['read_timeout'] = read_timeout
- manager.config_manager.global_settings_data['Rate_Limiting_Options']['download_attempts'] = download_attempts
- manager.config_manager.global_settings_data['Rate_Limiting_Options']['rate_limit'] = rate_limit
- manager.config_manager.global_settings_data['Rate_Limiting_Options']['download_delay'] = throttle
- manager.config_manager.global_settings_data['Rate_Limiting_Options']['max_simultaneous_downloads'] = max_simultaneous_downloads
- manager.config_manager.global_settings_data['Rate_Limiting_Options']['max_simultaneous_downloads_per_domain'] = max_simultaneous_downloads_per_domain
+ manager.config_manager.global_settings_data['Rate_Limiting_Options']['connection_timeout'] = int(connection_timeout)
+ 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']['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/cyberdrop_dl/ui/prompts/settings_user_prompts.py b/cyberdrop_dl/ui/prompts/settings_user_prompts.py
index 494e129a0..980cf7c91 100644
--- a/cyberdrop_dl/ui/prompts/settings_user_prompts.py
+++ b/cyberdrop_dl/ui/prompts/settings_user_prompts.py
@@ -197,47 +197,47 @@ def edit_file_size_limits_prompt(config: Dict) -> None:
console.print("Editing File Size Limits")
maximum_image_size = inquirer.number(
message="Enter the maximum image size:",
- default=config['File_Size_Limits']['maximum_image_size'],
+ default=int(config['File_Size_Limits']['maximum_image_size']),
validate=NumberValidator(),
long_instruction="This value is in bytes (0 is no limit)",
).execute()
maximum_video_size = inquirer.number(
message="Enter the maximum video size:",
- default=config['File_Size_Limits']['maximum_video_size'],
+ default=int(config['File_Size_Limits']['maximum_video_size']),
validate=NumberValidator(),
long_instruction="This value is in bytes (0 is no limit)",
).execute()
maximum_other_size = inquirer.number(
message="Enter the maximum other file type size:",
- default=config['File_Size_Limits']['maximum_other_size'],
+ default=int(config['File_Size_Limits']['maximum_other_size']),
validate=NumberValidator(),
long_instruction="This value is in bytes (0 is no limit)",
).execute()
minimum_image_size = inquirer.number(
message="Enter the minimum image size:",
- default=config['File_Size_Limits']['minimum_image_size'],
+ default=int(config['File_Size_Limits']['minimum_image_size']),
validate=NumberValidator(),
long_instruction="This value is in bytes (0 is no limit)",
).execute()
minimum_video_size = inquirer.number(
message="Enter the minimum video size:",
- default=config['File_Size_Limits']['minimum_video_size'],
+ default=int(config['File_Size_Limits']['minimum_video_size']),
validate=NumberValidator(),
long_instruction="This value is in bytes (0 is no limit)",
).execute()
minimum_other_size = inquirer.number(
message="Enter the minimum other file type size:",
- default=config['File_Size_Limits']['minimum_other_size'],
+ default=int(config['File_Size_Limits']['minimum_other_size']),
validate=NumberValidator(),
long_instruction="This value is in bytes (0 is no limit)",
).execute()
- config['File_Size_Limits']['maximum_image_size'] = maximum_image_size
- config['File_Size_Limits']['maximum_video_size'] = maximum_video_size
- config['File_Size_Limits']['maximum_other_size'] = maximum_other_size
- config['File_Size_Limits']['minimum_image_size'] = minimum_image_size
- config['File_Size_Limits']['minimum_video_size'] = minimum_video_size
- config['File_Size_Limits']['minimum_other_size'] = minimum_other_size
+ config['File_Size_Limits']['maximum_image_size'] = int(maximum_image_size)
+ config['File_Size_Limits']['maximum_video_size'] = int(maximum_video_size)
+ config['File_Size_Limits']['maximum_other_size'] = int(maximum_other_size)
+ config['File_Size_Limits']['minimum_image_size'] = int(minimum_image_size)
+ config['File_Size_Limits']['minimum_video_size'] = int(minimum_video_size)
+ config['File_Size_Limits']['minimum_other_size'] = int(minimum_other_size)
def edit_ignore_options_prompt(config: Dict) -> None: