update clips and database

This commit is contained in:
2026-07-17 20:28:07 -04:00
parent 8d6e29a161
commit 8be00d16d1
2 changed files with 38 additions and 59 deletions
+19 -2
View File
@@ -64,13 +64,30 @@ class Database:
self.CONN.commit()
self.CONN.close()
def mark_as_uploaded(self, record_id: int):
"""Flags a specific clip row record to uploaded (1)."""
id = "id"
if self.table == "clips":
id = "slug"
CURSOR.execute(
f"UPDATE {self.table} SET uploaded_yt = 1 WHERE {id} = ?",
(record_id,)
)
CONN.commit()
def mark_as_downloaded(self, record_id: int):
"""Updates the downloaded status to True (1) for a specific record ID."""
id = "id"
if self.table == "clips":
id = "slug"
# Updates the row matching the specific ID
# TODO clips uses slug
self.CURSOR.execute(
f"UPDATE {self.table} SET downloaded = 1 WHERE id = ?",
f"UPDATE {self.table} SET downloaded = 1 WHERE {id} = ?",
(record_id,)
)
self.CONN.commit()
@@ -102,7 +119,7 @@ class Database:
# Saves changes and closes the connection
self.CONN.commit()
def insert_clips_record(slug: str, record_date_str: str, title: str, gamename: str, clip_by: str, views: int):
def insert_clips_record(self, slug: str, record_date_str: str, title: str, gamename: str, clip_by: str, views: int):
"""Cleans up ISO-8601 strings into unified date structures for the database."""
try:
clean_date = datetime.strptime(record_date_str, "%Y-%m-%dT%H:%M:%SZ").date()