Skip to content

Bulk asynchronous downloader for multiple file hosts

Check referer before updating

Jules-WinnfieldX5f12d69d316e
diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py
index 489e9de11..182425351 100644
--- a/cyberdrop_dl/__init__.py
+++ b/cyberdrop_dl/__init__.py
@@ -1 +1 @@
-__version__ = "5.1.17"
+__version__ = "5.1.18"
diff --git a/cyberdrop_dl/utils/database/tables/history_table.py b/cyberdrop_dl/utils/database/tables/history_table.py
index cc9d94712..81a177f45 100644
--- a/cyberdrop_dl/utils/database/tables/history_table.py
+++ b/cyberdrop_dl/utils/database/tables/history_table.py
@@ -54,12 +54,13 @@ class HistoryTable:
url_path = await get_db_path(url, domain)
cursor = await self.db_conn.cursor()
- result = await cursor.execute("""SELECT completed FROM media WHERE domain = ? and url_path = ?""", (domain, url_path))
+ result = await cursor.execute("""SELECT referer, completed FROM media WHERE domain = ? and url_path = ?""", (domain, url_path))
sql_file_check = await result.fetchone()
- if sql_file_check and sql_file_check[0] != 0:
+ if sql_file_check and sql_file_check[1] != 0:
# Update the referer if it has changed so that check_complete_by_referer can work
- await cursor.execute("""UPDATE media SET referer = ? WHERE domain = ? and url_path = ?""", (str(referer), domain, url_path))
- await self.db_conn.commit()
+ if str(referer) != sql_file_check[0]:
+ await cursor.execute("""UPDATE media SET referer = ? WHERE domain = ? and url_path = ?""", (str(referer), domain, url_path))
+ await self.db_conn.commit()
return True
return False
diff --git a/pyproject.toml b/pyproject.toml
index a006898f1..b12cf59df 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cyberdrop-dl"
-version = "5.1.17"
+version = "5.1.18"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"