aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/archive.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-08-16 07:00:40 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2025-08-16 07:00:40 -0400
commit22e8d9823eb9fb802c926fb03a5fdccbea26f878 (patch)
treed399937a3bf139d386b8f5df2fc646b751c14719 /gallery_dl/archive.py
parent0839cde5064bd6000162ee23b8445b99afe10068 (diff)
parent3d18761f620a294ea6c5bff13c5994b93b29f3ed (diff)
Update upstream source from tag 'upstream/1.30.3'
Update to upstream version '1.30.3' with Debian dir cbd3490f51b0ee3f2e172965318cd079b856367d
Diffstat (limited to 'gallery_dl/archive.py')
-rw-r--r--gallery_dl/archive.py42
1 files changed, 21 insertions, 21 deletions
diff --git a/gallery_dl/archive.py b/gallery_dl/archive.py
index edecb10..3df5011 100644
--- a/gallery_dl/archive.py
+++ b/gallery_dl/archive.py
@@ -41,7 +41,7 @@ def connect(path, prefix, format,
def sanitize(name):
- return '"' + name.replace('"', "_") + '"'
+ return f'''"{name.replace('"', '_')}"'''
class DownloadArchive():
@@ -68,25 +68,25 @@ class DownloadArchive():
table = "archive" if table is None else sanitize(table)
self._stmt_select = (
- "SELECT 1 "
- "FROM " + table + " "
- "WHERE entry=? "
- "LIMIT 1")
+ f"SELECT 1 "
+ f"FROM {table} "
+ f"WHERE entry=? "
+ f"LIMIT 1")
self._stmt_insert = (
- "INSERT OR IGNORE INTO " + table + " "
- "(entry) VALUES (?)")
+ f"INSERT OR IGNORE INTO {table} "
+ f"(entry) VALUES (?)")
if pragma:
for stmt in pragma:
- cursor.execute("PRAGMA " + stmt)
+ cursor.execute(f"PRAGMA {stmt}")
try:
- cursor.execute("CREATE TABLE IF NOT EXISTS " + table + " "
- "(entry TEXT PRIMARY KEY) WITHOUT ROWID")
+ cursor.execute(f"CREATE TABLE IF NOT EXISTS {table} "
+ f"(entry TEXT PRIMARY KEY) WITHOUT ROWID")
except self._sqlite3.OperationalError:
# fallback for missing WITHOUT ROWID support (#553)
- cursor.execute("CREATE TABLE IF NOT EXISTS " + table + " "
- "(entry TEXT PRIMARY KEY)")
+ cursor.execute(f"CREATE TABLE IF NOT EXISTS {table} "
+ f"(entry TEXT PRIMARY KEY)")
def add(self, kwdict):
"""Add item described by 'kwdict' to archive"""
@@ -156,18 +156,18 @@ class DownloadArchivePostgresql():
table = "archive" if table is None else sanitize(table)
self._stmt_select = (
- "SELECT true "
- "FROM " + table + " "
- "WHERE entry=%s "
- "LIMIT 1")
+ f"SELECT true "
+ f"FROM {table} "
+ f"WHERE entry=%s "
+ f"LIMIT 1")
self._stmt_insert = (
- "INSERT INTO " + table + " (entry) "
- "VALUES (%s) "
- "ON CONFLICT DO NOTHING")
+ f"INSERT INTO {table} (entry) "
+ f"VALUES (%s) "
+ f"ON CONFLICT DO NOTHING")
try:
- cursor.execute("CREATE TABLE IF NOT EXISTS " + table + " "
- "(entry TEXT PRIMARY KEY)")
+ cursor.execute(f"CREATE TABLE IF NOT EXISTS {table} "
+ f"(entry TEXT PRIMARY KEY)")
con.commit()
except Exception as exc:
log.error("%s: %s when creating '%s' table: %s",