Skip to content

Bulk asynchronous downloader for multiple file hosts

remove cache db

Jules-WinnfieldXe5451c29fa58
diff --git a/cyberdrop_dl/managers/db_manager.py b/cyberdrop_dl/managers/db_manager.py
index 20cfd2845..3bb3b9f57 100644
--- a/cyberdrop_dl/managers/db_manager.py
+++ b/cyberdrop_dl/managers/db_manager.py
@@ -3,7 +3,6 @@ from pathlib import Path
import aiosqlite
-from cyberdrop_dl.utils.db.tables.cache_table import CacheTable
from cyberdrop_dl.utils.db.tables.history_table import HistoryTable
from cyberdrop_dl.utils.db.tables.temp_table import TempTable
@@ -16,7 +15,6 @@ class DBManager:
self.ignore_cache: bool = False
self.ignore_history: bool = False
- self.cache_table: CacheTable = field(init=False)
self.history_table: HistoryTable = field(init=False)
self.temp_table: TempTable = field(init=False)
@@ -24,16 +22,13 @@ class DBManager:
"""Startup process for the DBManager"""
self._db_conn = await aiosqlite.connect(self._db_path)
- self.cache_table = CacheTable(self._db_conn)
self.history_table = HistoryTable(self._db_conn)
self.temp_table = TempTable(self._db_conn)
- self.cache_table.ignore_cache = self.ignore_cache
self.history_table.ignore_history = self.ignore_history
await self._pre_allocate()
- await self.cache_table.startup()
await self.history_table.startup()
await self.temp_table.startup()
diff --git a/cyberdrop_dl/managers/manager.py b/cyberdrop_dl/managers/manager.py
index a675aaf70..665b718bd 100644
--- a/cyberdrop_dl/managers/manager.py
+++ b/cyberdrop_dl/managers/manager.py
@@ -119,7 +119,6 @@ class Manager:
MAX_NAME_LENGTHS['FOLDER'] = self.config_manager.global_settings_data['General']['max_folder_name_length']
self.db_manager.ignore_history = self.config_manager.settings_data['Runtime_Options']['ignore_history']
- self.db_manager.ignore_cache = self.config_manager.settings_data['Runtime_Options']['ignore_cache']
await self.db_manager.startup()
await self.progress_manager.startup()
diff --git a/cyberdrop_dl/ui/prompts/settings_user_prompts.py b/cyberdrop_dl/ui/prompts/settings_user_prompts.py
index 0a532c6c3..df9505adc 100644
--- a/cyberdrop_dl/ui/prompts/settings_user_prompts.py
+++ b/cyberdrop_dl/ui/prompts/settings_user_prompts.py
@@ -295,9 +295,6 @@ def edit_runtime_options_prompt(config: Dict) -> None:
action = inquirer.checkbox(
message="Select the runtime options you want to enable:",
choices=[
- Choice(value="ignore_cache",
- name="Ignore the cache (cached versions of Coomer/Kemono)",
- enabled=config["Runtime_Options"]["ignore_cache"]),
Choice(value="ignore_history",
name="Ignore the history (previously downloaded files)",
enabled=config["Runtime_Options"]["ignore_history"]),
diff --git a/cyberdrop_dl/utils/args/config_definitions.py b/cyberdrop_dl/utils/args/config_definitions.py
index 23eaf78bc..871a889ba 100644
--- a/cyberdrop_dl/utils/args/config_definitions.py
+++ b/cyberdrop_dl/utils/args/config_definitions.py
@@ -81,7 +81,6 @@ settings: Dict = {
"only_hosts": [],
},
"Runtime_Options": {
- "ignore_cache": False,
"ignore_history": False,
"skip_check_for_partial_files": False,
"skip_check_for_empty_folders": False,
diff --git a/cyberdrop_dl/utils/db/table_definitions.py b/cyberdrop_dl/utils/db/table_definitions.py
index 5fd81b6b5..365f8008f 100644
--- a/cyberdrop_dl/utils/db/table_definitions.py
+++ b/cyberdrop_dl/utils/db/table_definitions.py
@@ -8,5 +8,3 @@ create_history = """CREATE TABLE IF NOT EXISTS media (domain TEXT,
);"""
create_temp = """CREATE TABLE IF NOT EXISTS temp (downloaded_filename TEXT);"""
-
-create_cache = """CREATE TABLE IF NOT EXISTS cache (url_path TEXT, post_data BLOB, PRIMARY KEY (url_path));"""
diff --git a/cyberdrop_dl/utils/db/tables/cache_table.py b/cyberdrop_dl/utils/db/tables/cache_table.py
deleted file mode 100644
index 14a301154..000000000
--- a/cyberdrop_dl/utils/db/tables/cache_table.py
+++ /dev/null
@@ -1,36 +0,0 @@
-from typing import TYPE_CHECKING, Optional
-
-import aiosqlite
-
-from cyberdrop_dl.utils.db.table_definitions import create_cache
-
-if TYPE_CHECKING:
- from yarl import URL
-
-
-class CacheTable:
- def __init__(self, db_conn: aiosqlite.Connection):
- self.db_conn: aiosqlite.Connection = db_conn
- self.ignore_cache: bool = False
-
- async def startup(self) -> None:
- """Startup process for the CacheTable"""
- await self.db_conn.execute(create_cache)
- await self.db_conn.commit()
-
- async def insert_blob(self, blob: str, url: 'URL') -> None:
- """Inserts the post content into coomeno"""
- await self.db_conn.execute("""INSERT OR IGNORE INTO cache VALUES (?, ?)""", (url.path, blob,))
- await self.db_conn.commit()
-
- async def get_blob(self, url: 'URL') -> Optional[str]:
- """returns the post content for a given coomeno post url"""
- if self.ignore_cache:
- return None
-
- cursor = await self.db_conn.cursor()
- await cursor.execute("""SELECT post_data FROM cache WHERE url_path = ?""", (url.path,))
- sql_file_check = await cursor.fetchone()
- if sql_file_check:
- return sql_file_check[0]
- return None
diff --git a/cyberdrop_dl/utils/transfer/transfer_v4_config.py b/cyberdrop_dl/utils/transfer/transfer_v4_config.py
index 3fb417258..1bebd5fac 100644
--- a/cyberdrop_dl/utils/transfer/transfer_v4_config.py
+++ b/cyberdrop_dl/utils/transfer/transfer_v4_config.py
@@ -73,7 +73,6 @@ def transfer_v4_config(manager: Manager, old_config_path: Path, new_config_name:
new_user_data['Ignore_Options']['skip_hosts'] = old_data['Ignore']['skip_hosts']
new_user_data['Ignore_Options']['only_hosts'] = old_data['Ignore']['only_hosts']
- new_user_data['Runtime_Options']['ignore_cache'] = old_data['Ignore']['ignore_cache']
new_user_data['Runtime_Options']['ignore_history'] = old_data['Ignore']['ignore_history']
new_user_data['Runtime_Options']['skip_check_for_partial_files'] = old_data['Runtime']['skip_check_for_partial_files_and_empty_dirs']
new_user_data['Runtime_Options']['skip_check_for_empty_folders'] = old_data['Runtime']['skip_check_for_partial_files_and_empty_dirs']
diff --git a/cyberdrop_dl/utils/transfer/transfer_v4_db.py b/cyberdrop_dl/utils/transfer/transfer_v4_db.py
index 9ec8606f7..183f239d8 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_cache, create_temp
+from cyberdrop_dl.utils.db.table_definitions import create_history, create_temp
def transfer_v4_db(db_path: Path, new_db_path: Path) -> None:
@@ -10,7 +10,6 @@ def transfer_v4_db(db_path: Path, new_db_path: Path) -> None:
new_db_connection = sqlite3.connect(new_db_path)
new_db_connection.execute(create_history)
- new_db_connection.execute(create_cache)
new_db_connection.execute(create_temp)
query = "SELECT domain, url_path, referer, download_filename, original_filename, completed FROM media WHERE completed = 1"
@@ -23,10 +22,6 @@ def transfer_v4_db(db_path: Path, new_db_path: Path) -> None:
new_db_connection.execute("insert into temp values (?)", old_data_temp)
del old_data_temp
- old_data_cache = old_db_connection.execute("SELECT * FROM coomeno").fetchall()
- new_db_connection.execute("insert into cache values (?, ?)", old_data_cache)
- del old_data_cache
-
new_db_connection.commit()
old_db_connection.close()
new_db_connection.close()