Skip to content

Bulk asynchronous downloader for multiple file hosts

re-add previous hashes to allow for same filename removall

datawhores3918a2d69bde
diff --git a/cyberdrop_dl/clients/hash_client.py b/cyberdrop_dl/clients/hash_client.py
index 867bb3dd5..94e48e3e4 100644
--- a/cyberdrop_dl/clients/hash_client.py
+++ b/cyberdrop_dl/clients/hash_client.py
@@ -27,6 +27,7 @@ class HashClient:
def __init__(self,manager):
self.manager=manager
self.hashes=defaultdict(lambda:None)
+ self.prev_hashes=None
@asynccontextmanager
async def _manager_context(self):
@@ -34,7 +35,8 @@ class HashClient:
yield
await self.manager.close()
async def startup(self):
- pass
+ self.prev_hashes=set(await self.manager.db_manager.hash_table.get_all_unique_hashes())
+
@@ -166,10 +168,11 @@ class HashClient:
continue
elif not self.manager.config_manager.global_settings_data['Dupe_Cleanup_Options']['keep_prev_download']:
continue
- elif len(other_matches)==0:
- continue
elif selected_file in self.manager.path_manager.prev_downloads_paths:
continue
+ elif hash not in self.prev_hashes:
+ continue
+
else:
try:
if ele.exists():
diff --git a/docs/reference/configuration-options/global-settings.md b/docs/reference/configuration-options/global-settings.md
index 4aa87f14a..aef64c975 100644
--- a/docs/reference/configuration-options/global-settings.md
+++ b/docs/reference/configuration-options/global-settings.md
@@ -147,7 +147,7 @@ If 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
- The file did not exist on the filesystem prior to the current run
- 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
+- The hash must have already existing on the system prior to the current run
* keep\_prev\_download
prev 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 size