Skip to content

Commit

Permalink
Ensure error column is created
Browse files Browse the repository at this point in the history
  • Loading branch information
deldesir authored Jul 21, 2024
1 parent 420e992 commit 2546b4e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cps/tasks/metadata_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ def _fetch_requested_urls(self, conn):
try:
cursor = conn.execute("PRAGMA table_info(media)")
self.columns = [column[1] for column in cursor.fetchall()]
query = ("SELECT path, duration, live_status FROM media WHERE error IS NULL AND path LIKE 'http%'"
if "error" in self.columns
else "SELECT path, duration, live_status FROM media WHERE path LIKE 'http%'")
query = "SELECT path, duration, live_status FROM media WHERE path LIKE 'http%'"
if "error" in self.columns:
query += " AND error IS NULL"
else:
conn.execute("ALTER TABLE media ADD COLUMN error TEXT")
rows = conn.execute(query).fetchall()
requested_urls = {}
for path, duration, live_status in rows:
Expand Down

0 comments on commit 2546b4e

Please sign in to comment.