Skip to content

Bulk asynchronous downloader for multiple file hosts

Fix DB Transfer

Jules-WinnfieldX51c2dafe8a37
diff --git a/cyberdrop_dl/managers/manager.py b/cyberdrop_dl/managers/manager.py
index 7e63749ba..665b718bd 100644
--- a/cyberdrop_dl/managers/manager.py
+++ b/cyberdrop_dl/managers/manager.py
@@ -88,7 +88,7 @@ class Manager:
def file_startup(self) -> None:
"""Start the file manager"""
self.file_manager.input_file = Path(self.config_manager.settings_data['Files']['input_file'])
- self.file_manager.history_db = Path(self.directory_manager.cache / "cyberdrop.database")
+ self.file_manager.history_db = Path(self.directory_manager.cache / "cyberdrop.db")
self.file_manager.main_log = Path(
self.directory_manager.logs / self.config_manager.settings_data['Logs']['main_log_filename'])
diff --git a/cyberdrop_dl/utils/database/tables/history_table.py b/cyberdrop_dl/utils/database/tables/history_table.py
index 0415d0e49..a9214319e 100644
--- a/cyberdrop_dl/utils/database/tables/history_table.py
+++ b/cyberdrop_dl/utils/database/tables/history_table.py
@@ -14,13 +14,6 @@ async def get_db_path(url: URL, referer: str = "") -> str:
"""Gets the URL path to be put into the DB and checked from the DB"""
url_path = url.path
- if url.host and ('anonfiles' in url.host or 'bayfiles' in url.host):
- url_parts = url_path.split('/')
- url_parts.pop(0)
- if len(url_parts) > 1:
- url_parts.pop(1)
- url_path = '/' + '/'.join(url_parts)
-
if referer and "e-hentai" in referer:
url_path = url_path.split('keystamp')[0][:-1]
diff --git a/cyberdrop_dl/utils/transfer/transfer_v4_db.py b/cyberdrop_dl/utils/transfer/transfer_v4_db.py
index 183f239d8..f521e9007 100644
--- a/cyberdrop_dl/utils/transfer/transfer_v4_db.py
+++ b/cyberdrop_dl/utils/transfer/transfer_v4_db.py
@@ -1,7 +1,7 @@
import sqlite3
from pathlib import Path
-from cyberdrop_dl.utils.db.table_definitions import create_history, create_temp
+from cyberdrop_dl.utils.database.table_definitions import create_history, create_temp
def transfer_v4_db(db_path: Path, new_db_path: Path) -> None:
@@ -15,13 +15,9 @@ def transfer_v4_db(db_path: Path, new_db_path: Path) -> None:
query = "SELECT domain, url_path, referer, download_filename, original_filename, completed FROM media WHERE completed = 1"
old_data_history = old_db_connection.execute(query).fetchall()
- new_db_connection.execute("insert into media values (?, ?, ?, ?, ?, ?)", old_data_history)
+ new_db_connection.executemany("insert into media values (?, ?, ?, ?, ?, ?)", old_data_history)
del old_data_history
- old_data_temp = old_db_connection.execute("SELECT * FROM temp").fetchall()
- new_db_connection.execute("insert into temp values (?)", old_data_temp)
- del old_data_temp
-
new_db_connection.commit()
old_db_connection.close()
new_db_connection.close()