Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
merge
datawhores9df5f21948b1
diff --git a/cyberdrop_dl/clients/hash_client.py b/cyberdrop_dl/clients/hash_client.pyindex 787587883..fb0c71079 100644--- a/cyberdrop_dl/clients/hash_client.py+++ b/cyberdrop_dl/clients/hash_client.py@@ -7,6 +7,7 @@ from send2trash import send2trashfrom cyberdrop_dl.utils.dataclasses.url_objects import MediaItemfrom cyberdrop_dl.utils.utilities import log+from cyberdrop_dl.ui.prompts.continue_prompt import enter_to_continue@asynccontextmanager@@ -18,11 +19,16 @@ async def hash_scan_directory_context(manager):def hash_directory_scanner(manager, path):asyncio.run(_hash_directory_scanner_helper(manager, path))+ enter_to_continue()async def _hash_directory_scanner_helper(manager, path):async with hash_scan_directory_context(manager):await manager.hash_manager.hash_client.hash_directory(path)+ await manager.progress_manager.print_stats()+++class HashClient:@@ -65,7 +71,8 @@ class HashClient:await self.manager.progress_manager.hash_progress.add_new_completed_hash()else:await self.manager.progress_manager.hash_progress.add_prev_hash()- await self.manager.db_manager.hash_table.insert_or_update_hash_db(hash, file, original_filename, refer)+ await self.manager.db_manager.hash_table.insert_or_update_hash_db(hash+ , file, original_filename, refer)except Exception as e:await log(f"Error hashing {file} : {e}", 40)self.hashes[key] = hashdiff --git a/cyberdrop_dl/managers/manager.py b/cyberdrop_dl/managers/manager.pyindex 87d32f515..754f09e41 100644--- a/cyberdrop_dl/managers/manager.py+++ b/cyberdrop_dl/managers/manager.py@@ -226,3 +226,7 @@ class Manager:await self.db_manager.close()self.console_manager.close()self.db_manager: DBManager = field(init=False)+ self.console_manager: ConsoleManager = field(init=False)+ self.console_manager: CacheManager = field(init=False)+ self.hash_manager: HashManager = field(init=False)+diff --git a/cyberdrop_dl/ui/prompts/continue_prompt.py b/cyberdrop_dl/ui/prompts/continue_prompt.pynew file mode 100644index 000000000..01f14f91c--- /dev/null+++ b/cyberdrop_dl/ui/prompts/continue_prompt.py@@ -0,0 +1,5 @@+from InquirerPy import inquirer+def enter_to_continue():+ inquirer.text(+ message="press enter to continue",+ ).execute()diff --git a/cyberdrop_dl/ui/prompts/settings_hash_prompts.py b/cyberdrop_dl/ui/prompts/settings_hash_prompts.pyindex 96431e96d..6c492d1f5 100644--- a/cyberdrop_dl/ui/prompts/settings_hash_prompts.py+++ b/cyberdrop_dl/ui/prompts/settings_hash_prompts.py@@ -18,3 +18,4 @@ def path_prompt(manager: Manager):validate=PathValidator(is_dir=True, message="Input is not a directory"),).execute()return hash_path+diff --git a/cyberdrop_dl/utils/database/tables/hash_table.py b/cyberdrop_dl/utils/database/tables/hash_table.pyindex 6e4021f25..18ead5527 100644--- a/cyberdrop_dl/utils/database/tables/hash_table.py+++ b/cyberdrop_dl/utils/database/tables/hash_table.py@@ -125,7 +125,7 @@ class HashTable:(hash_value, file_size, download_filename, folder, original_filename, referer))await self.db_conn.commit()return True- except IntegrityError:+ except IntegrityError as _:# Handle potential duplicate key (assuming a unique constraint on hash, filename, and folder)await cursor.execute("""UPDATE hashSET file_size = ?,