Skip to content

Bulk asynchronous downloader for multiple file hosts

get full path when inserting

datawhores2ecd96a2c241
diff --git a/cyberdrop_dl/clients/hash_client.py b/cyberdrop_dl/clients/hash_client.py
index 7bade4bd3..88fee99c8 100644
--- a/cyberdrop_dl/clients/hash_client.py
+++ b/cyberdrop_dl/clients/hash_client.py
@@ -29,7 +29,7 @@ class HashClient:
hash=await self.manager.db_manager.hash_table.get_file_hash_exists(file)
if not hash and file.exists():
hash = await self.manager.hash_manager.hash_file(file)
- await self.manager.db_manager.hash_table.insert_or_update_hash_db(hash, file.stat().st_size, file.name, file.parent)
+ await self.manager.db_manager.hash_table.insert_or_update_hash_db(hash, file.stat().st_size, file)
return hash
async def cleanup_dupes(self):
diff --git a/cyberdrop_dl/utils/database/tables/hash_table.py b/cyberdrop_dl/utils/database/tables/hash_table.py
index e3e7ffb3c..68e18fde6 100644
--- a/cyberdrop_dl/utils/database/tables/hash_table.py
+++ b/cyberdrop_dl/utils/database/tables/hash_table.py
@@ -70,7 +70,7 @@ class HashTable:
return []
- async def insert_or_update_hash_db(self, hash_value, file_size, filename, folder):
+ async def insert_or_update_hash_db(self, hash_value, file_size, file):
"""
Inserts or updates a record in the specified SQLite database.
@@ -85,9 +85,10 @@ class HashTable:
"""
cursor = await self.db_conn.cursor()
+ full_path=pathlib.Path(file).absolute()
- filename=str(filename)
- folder=str(folder)
+ filename=full_path.name
+ folder=full_path.parent
# Assuming a table named 'file_info' with columns: id (primary key), hash, size, filename, folder
try: