Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Check referer before updating
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Dec 20, 2023
1 parent 43cc973 commit 5f12d69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cyberdrop_dl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.1.17"
__version__ = "5.1.18"
9 changes: 5 additions & 4 deletions cyberdrop_dl/utils/database/tables/history_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ async def check_complete(self, domain: str, url: URL, referer: URL) -> bool:

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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 5f12d69

Please sign in to comment.