download edit

This commit is contained in:
t0is 2025-04-05 15:25:04 +02:00
parent cbdfa9f76a
commit 42fba5391a

View File

@ -74,7 +74,10 @@ def db_set_col(db, video_id, column, value=True):
Also updates the updated_at timestamp. Also updates the updated_at timestamp.
""" """
cursor = db.cursor() cursor = db.cursor()
query = f"UPDATE videos SET {column} = %s WHERE id = %s" if column == "data_downloaded":
query = f"UPDATE videos SET {column} = %s, download_end=NOW() WHERE id = %s"
else:
query = f"UPDATE videos SET {column} = %s WHERE id = %s"
cursor.execute(query, (value, video_id)) cursor.execute(query, (value, video_id))
db.commit() db.commit()
cursor.close() cursor.close()
@ -88,7 +91,7 @@ def try_lock_video(db, video_id):
cursor = db.cursor() cursor = db.cursor()
query = """ query = """
UPDATE videos UPDATE videos
SET data_downloading = 1, updated_at = NOW() SET data_downloading = 1, updated_at = NOW(), download_start = NOW()
WHERE id = %s AND data_downloading = 0 WHERE id = %s AND data_downloading = 0
""" """
cursor.execute(query, (video_id,)) cursor.execute(query, (video_id,))