created new files for transcribing videos , find tranding hashtags
This commit is contained in:
+32
-19
@@ -17,7 +17,7 @@ class Database:
|
||||
if self.table == "vods":
|
||||
self.columns = "id, date, title, gamename, downloaded, uploaded_yt, chat_upload_yt"
|
||||
elif self.table == "clips":
|
||||
self.columns = "slug, date, title, gamename, clip_by, view_count, downloaded, uploaded_yt"
|
||||
self.columns = "slug, date, title, gamename, clip_by, view_count, downloaded, uploaded_yt, shorts_upload_yt"
|
||||
|
||||
if not file_exists:
|
||||
self.create_database()
|
||||
@@ -65,36 +65,49 @@ 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)."""
|
||||
|
||||
def __mark_as(self, record_id: int, set_sql: str):
|
||||
id = "id"
|
||||
|
||||
if self.table == "clips":
|
||||
id = "slug"
|
||||
|
||||
self.CURSOR.execute(
|
||||
f"UPDATE {self.table} SET uploaded_yt = 1 WHERE {id} = ?",
|
||||
f"UPDATE {self.table} SET {set_sql} = 1 WHERE {id} = ?",
|
||||
(record_id,)
|
||||
)
|
||||
self.CONN.commit()
|
||||
|
||||
def mark_as_uploaded_shorts_chats(self, record_id: int):
|
||||
"""Flags a specific row record to uploaded (1)."""
|
||||
|
||||
set_sql = "chat_upload_yt"
|
||||
if self.table == "clips":
|
||||
set_sql = "shorts_uploaded_yt"
|
||||
|
||||
self.__mark_as(record_id, set_sql)
|
||||
|
||||
def mark_as_uploaded(self, record_id: int):
|
||||
"""Flags a specific row record to uploaded (1)."""
|
||||
|
||||
self.__mark_as(record_id, "uploaded_yt")
|
||||
|
||||
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} = ?",
|
||||
(record_id,)
|
||||
)
|
||||
self.CONN.commit()
|
||||
self.__mark_as(record_id, "download")
|
||||
|
||||
def get_unuploaded(self):
|
||||
def get_unuploaded_shorts_chats(self):
|
||||
"""Retrieves all clip rows remaining to be chat uploaded."""
|
||||
|
||||
where_sql = "chat_upload_yt"
|
||||
if self.table == "clips":
|
||||
where_sql = "shorts_uploaded_yt"
|
||||
|
||||
self.CURSOR.execute(f"SELECT {self.columns} FROM {self.table} WHERE downloaded = 1 AND uploaded_yt = 1 AND {where_sql} = 0")
|
||||
return self.CURSOR.fetchall()
|
||||
|
||||
def get_unuploaded(self):
|
||||
"""Retrieves all clip rows remaining to be uploaded."""
|
||||
self.CURSOR.execute(f"SELECT {self.columns} FROM {self.table} WHERE downloaded = 1 AND uploaded_yt = 0")
|
||||
return self.CURSOR.fetchall()
|
||||
|
||||
@@ -128,7 +141,7 @@ class Database:
|
||||
clean_date = record_date_str
|
||||
|
||||
self.CURSOR.execute(
|
||||
f"INSERT OR IGNORE INTO {self.table} ({self.columns}) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
(slug, str(clean_date), title, gamename, clip_by, views, False, False),
|
||||
f"INSERT OR IGNORE INTO {self.table} ({self.columns}) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
(slug, str(clean_date), title, gamename, clip_by, views, False, False, False),
|
||||
)
|
||||
self.CONN.commit()
|
||||
Reference in New Issue
Block a user