Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
fix create file hash
datawhores93825a014ca5
diff --git a/cyberdrop_dl/clients/hash_client.py b/cyberdrop_dl/clients/hash_client.pyindex a5f4039de..7f932baee 100644--- a/cyberdrop_dl/clients/hash_client.py+++ b/cyberdrop_dl/clients/hash_client.py@@ -1,13 +1,25 @@import pathlib+import asynciofrom contextlib import asynccontextmanagerfrom collections import defaultdict-import asynciofrom cyberdrop_dl.utils.utilities import logfrom send2trash import send2trashfrom cyberdrop_dl.utils.dataclasses.url_objects import MediaItem+@asynccontextmanager+async def hash_scan_directory_context(manager):+ await manager.async_db_hash_startup()+ yield+ await manager.close()++def hash_directory_scanner(manager,path):+ asyncio.run(_hash_directory_scanner_helper(manager,path))++async def _hash_directory_scanner_helper(manager,path):+ async with hash_scan_directory_context(manager):+ await manager.hash_manager.hash_client.hash_directory(path)class HashClient:@@ -22,11 +34,9 @@ class HashClient:await self.manager.async_db_hash_startup()yieldawait self.manager.close()-- def hash_directory(self,path):- asyncio.run(self._hash_directory_helper(path))- async def _hash_directory_helper(self,path):++ async def hash_directory(self,path):async with self._manager_context():async with self.manager.live_manager.get_hash_live(stop=True):#force start live manager for db connectiondiff --git a/cyberdrop_dl/ui/ui.py b/cyberdrop_dl/ui/ui.pyindex aad91add1..87861596b 100644--- a/cyberdrop_dl/ui/ui.py+++ b/cyberdrop_dl/ui/ui.py@@ -16,6 +16,7 @@ from cyberdrop_dl.ui.prompts.settings_global_prompts import edit_global_settingsfrom cyberdrop_dl.ui.prompts.url_file_prompts import edit_urls_promptfrom cyberdrop_dl.ui.prompts.settings_user_prompts import create_new_config_prompt, edit_config_values_promptfrom cyberdrop_dl.ui.prompts.settings_hash_prompts import path_prompt+from cyberdrop_dl.clients.hash_client import hash_directory_scannerconsole = Console()@@ -50,7 +51,7 @@ def program_ui(manager: Manager):# Scanning folder to create hasheselif action == 4:path=path_prompt(manager)- manager.hash_manager.hash_client.hash_directory(path)+ hash_directory_scanner(manager,path)# Sort All Configselif action == 5: