Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
fix more queries
datawhoresa375b2bf7d9d
diff --git a/cyberdrop_dl/utils/database/tables/hash_table.py b/cyberdrop_dl/utils/database/tables/hash_table.pyindex 565b42fbe..6440594f6 100644--- a/cyberdrop_dl/utils/database/tables/hash_table.py+++ b/cyberdrop_dl/utils/database/tables/hash_table.py@@ -40,7 +40,7 @@ class HashTable:cursor = await self.db_conn.cursor()# Check if the file exists with matching folder, filename, and size- await cursor.execute("SELECT hash FROM hash WHERE folder=? AND download_filename=? AND size=?", (folder, filename, size))+ await cursor.execute("SELECT hash FROM hash WHERE folder=? AND download_filename=? AND file_size=?", (folder, filename, size))result = await cursor.fetchone()if result and result[0]:return result[0]@@ -63,7 +63,7 @@ class HashTable:cursor = await self.db_conn.cursor()try:- await cursor.execute("SELECT folder, download_filename FROM hash WHERE hash = ? and size=?", (hash_value,size))+ await cursor.execute("SELECT folder, download_filename FROM hash WHERE hash = ? and file_size=?", (hash_value,size))results = await cursor.fetchall()return resultsexcept Exception as e:@@ -94,14 +94,14 @@ class HashTable:# Assuming a table named 'file_info' with columns: id (primary key), hash, size, filename, foldertry:- await cursor.execute("INSERT INTO hash (hash, size, download_filename, folder,original_filename,referer) VALUES (?, ?, ?, ?,?,?)",+ await cursor.execute("INSERT INTO hash (hash, file_size, download_filename, folder,original_filename,referer) VALUES (?, ?, ?, ?,?,?)",(hash_value, file_size, download_filename, folder,original_filename,referer))await self.db_conn.commit()return Trueexcept IntegrityError:# Handle potential duplicate key (assuming a unique constraint on hash, filename, and folder)await cursor.execute("""UPDATE hash- SET size = ?,+ SET file_size = ?,hash = ?,referer= CASE WHEN ? IS NOT NULL THEN ? ELSE referer END,original_filename = CASE WHEN ? IS NOT NULL THEN ? ELSE original_filename END