Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
Fix bug with pre-allocation
Jules-WinnfieldXb701b18df931
diff --git a/README.md b/README.mdindex 1d4399a0f..db4decb6f 100644--- a/README.md+++ b/README.md@@ -1,7 +1,7 @@# `cyberdrop-dl`**Bulk downloader for multiple file hosts**-The latest version of the program is 3.5.4+The latest version of the program is 3.5.5<a href="https://www.buymeacoffee.com/juleswinnft" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>diff --git a/changelog.txt b/changelog.txtindex 5f6e6d63c..e55c96f3d 100644--- a/changelog.txt+++ b/changelog.txt@@ -42,4 +42,7 @@- added more line output during config creation/validation3.5.4-- Fix skip sites\ No newline at end of file+- Fix skip sites++3.5.5+- Fix bug with pre-allocation\ No newline at end of filediff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.pyindex 7a829927f..4c5818f30 100644--- a/cyberdrop_dl/__init__.py+++ b/cyberdrop_dl/__init__.py@@ -1 +1 @@-__version__ = "3.5.4"+__version__ = "3.5.5"diff --git a/cyberdrop_dl/base_functions/sql_helper.py b/cyberdrop_dl/base_functions/sql_helper.pyindex 3f23087be..5021524a1 100644--- a/cyberdrop_dl/base_functions/sql_helper.py+++ b/cyberdrop_dl/base_functions/sql_helper.py@@ -14,23 +14,26 @@ class SQLHelper:atexit.register(self.exit_handler)async def sql_initialize(self):- if os.path.exists("download_history_size_based.sqlite"):- os.remove("download_history_size_based.sqlite")self.conn = sqlite3.connect(self.download_history)self.curs = self.conn.cursor()++ await self.create_tables()+ await self.pre_allocate()++ await self.check_columns()++ async def create_tables(self):create_table_query = """CREATE TABLE IF NOT EXISTS downloads (- path TEXT,- downloaded_filename TEXT,- completed INTEGER NOT NULL,- PRIMARY KEY (path)- );"""+ path TEXT,+ downloaded_filename TEXT,+ completed INTEGER NOT NULL,+ PRIMARY KEY (path)+ );"""create_temp_download_name_query = """CREATE TABLE IF NOT EXISTS downloads_temp (- downloaded_filename TEXT- );"""+ downloaded_filename TEXT+ );"""temp_truncate_query = """DELETE FROM downloads_temp;"""- pre_alloc = "CREATE TABLE t(x);"- pre_alloc2 = "INSERT INTO t VALUES(zeroblob(50*1024*1024));" # 50 mb- drop_pre = "DROP TABLE t;"+self.curs.execute(create_table_query)self.conn.commit()self.curs.execute(create_temp_download_name_query)@@ -38,16 +41,21 @@ class SQLHelper:self.curs.execute(temp_truncate_query)self.conn.commit()+ async def pre_allocate(self):+ pre_alloc = "CREATE TABLE IF NOT EXISTS t(x);"+ pre_alloc2 = "INSERT INTO t VALUES(zeroblob(50*1024*1024));" # 50 mb+ drop_pre = "DROP TABLE t;"check_prealloc = "PRAGMA freelist_count;"+self.curs.execute(check_prealloc)free = self.curs.fetchone()[0]if free <= 1024:self.curs.execute(pre_alloc)+ self.conn.commit()self.curs.execute(pre_alloc2)self.conn.commit()self.curs.execute(drop_pre)self.conn.commit()- await self.check_columns()async def check_columns(self):self.curs.execute("""SELECT COUNT(*) AS CNTREC FROM pragma_table_info('downloads') WHERE