Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
remove need for prev hash it is redundant and make all requirements passed to remove
datawhores7c1be97206a6
diff --git a/cyberdrop_dl/clients/hash_client.py b/cyberdrop_dl/clients/hash_client.pyindex c27ea3aca..867bb3dd5 100644--- a/cyberdrop_dl/clients/hash_client.py+++ b/cyberdrop_dl/clients/hash_client.py@@ -27,7 +27,6 @@ class HashClient:def __init__(self,manager):self.manager=managerself.hashes=defaultdict(lambda:None)- self.prev_hashes=None@asynccontextmanagerasync def _manager_context(self):@@ -35,7 +34,7 @@ class HashClient:yieldawait self.manager.close()async def startup(self):- self.prev_hashes=set(await self.manager.db_manager.hash_table.get_all_unique_hashes())+ pass@@ -135,15 +134,15 @@ class HashClient:await self.manager.db_manager.hash_table.get_files_with_hash_matches(hash, size)))# Filter out files with the same path as any file in other_files- filtered_matches = [match for match in all_matches if str(match) not in other_files]+ other_matches = [match for match in all_matches if str(match) not in other_files]#Filter files based on if the file exists- filtered_matches = list(filter(lambda x: x.exists(),filtered_matches ))+ existing_other_matches = list(filter(lambda x: x.exists(),other_matches ))#what do do with prev matches and current file- if len(filtered_matches) == 0:+ if len(existing_other_matches) == 0:passelif not self.manager.config_manager.global_settings_data['Dupe_Cleanup_Options']['keep_prev_download']:- for ele in filtered_matches:+ for ele in existing_other_matches:if not ele.exists():continuetry:@@ -154,7 +153,7 @@ class HashClient:continue#delete all prev match except for oneelse:- for ele in filtered_matches[1:]:+ for ele in existing_other_matches[1:]:if not ele.exists():continuetry:@@ -165,10 +164,10 @@ class HashClient:continueif self.manager.config_manager.global_settings_data['Dupe_Cleanup_Options']['keep_new_download']:continue- elif hash not in self.prev_hashes:- continueelif not self.manager.config_manager.global_settings_data['Dupe_Cleanup_Options']['keep_prev_download']:continue+ elif len(other_matches)==0:+ continueelif selected_file in self.manager.path_manager.prev_downloads_paths:continueelse:diff --git a/docs/reference/configuration-options/global-settings.md b/docs/reference/configuration-options/global-settings.mdindex c839c12e8..4aa87f14a 100644--- a/docs/reference/configuration-options/global-settings.md+++ b/docs/reference/configuration-options/global-settings.md@@ -145,19 +145,14 @@ With this set as True. Files can be hash after each download, rather than all toIf enabled for each hash and size match one download will be kept on the system.If disabled all current files will be deleted if the following is all true-- This is not the first time the hash has appeared in the filesystem- The file did not exist on the filesystem prior to the current run--or-- keep prev_download is set to true, this ignores if file exists on the filesystem or not-+- A file must be in the database with a matching hash. This excludes files downloaded and skipped for already existing* keep\_prev\_downloadprev downloads are files that are match with the list of files to be processed. A previous download is one not processed by the urls given and that exists in the database for the same hash and file sizeIf enabled then at least one existing previous download will be kept on system.-If not enabled all previous downloads will be deleted</details>