update clips and database
This commit is contained in:
+19
-2
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user