Skip to content

Bulk asynchronous downloader for multiple file hosts

Try and increase speed of SQL portion

Jules-WinnfieldXbde751c818dc
diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py
index d00ccbef0..4de2b4e35 100644
--- a/cyberdrop_dl/__init__.py
+++ b/cyberdrop_dl/__init__.py
@@ -1 +1 @@
-__version__ = "2.13.5"
+__version__ = "2.13.6"
diff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.py
index e1b24d1d7..9520ce6c8 100644
--- a/cyberdrop_dl/main.py
+++ b/cyberdrop_dl/main.py
@@ -68,6 +68,7 @@ async def download_all(args: argparse.Namespace):
all_files = [str(f) for f in pathlib.Path(args.output_folder).glob("**/*") if f.is_file()]
combined = '\t'.join(all_files)
+ conn.commit()
log('Purging empty directories')
deleted = purge_dir(args.output_folder)
diff --git a/cyberdrop_dl/utils/base_functions.py b/cyberdrop_dl/utils/base_functions.py
index 608e8004b..537692755 100644
--- a/cyberdrop_dl/utils/base_functions.py
+++ b/cyberdrop_dl/utils/base_functions.py
@@ -83,12 +83,10 @@ async def sql_check_existing(cursor: sqlite3.Cursor, url, size):
async def sql_insert_file(connection: sqlite3.Connection, cursor: sqlite3.Cursor, filename, size, completed):
cursor.execute("""INSERT OR IGNORE INTO downloads VALUES ('%s', %d, %d)""" % (filename, size, completed))
- connection.commit()
async def sql_update_file(connection: sqlite3.Connection, cursor: sqlite3.Cursor, filename, size, completed):
cursor.execute("""INSERT OR REPLACE INTO downloads VALUES ('%s', %d, %d)""" % (filename, size, completed))
- connection.commit()
def log(text, style=Fore.WHITE) -> None:
diff --git a/cyberdrop_dl/utils/downloaders.py b/cyberdrop_dl/utils/downloaders.py
index d851bf52c..34c48a9aa 100644
--- a/cyberdrop_dl/utils/downloaders.py
+++ b/cyberdrop_dl/utils/downloaders.py
@@ -239,6 +239,7 @@ class Downloader:
(self.folder / self.title).mkdir(parents=True, exist_ok=True)
async with aiohttp.ClientSession(cookie_jar=self.cookie_jar) as session:
await self.download_all(self.album_obj, session, show_progress=show_progress)
+ self.connection.commit()
def get_downloaders(Cascade: CascadeItem, folder: Path, attempts: int, disable_attempt_limit: bool, threads: int, exclude_videos: bool,