github-actions[bot] commited on
Commit
82ee8e4
·
1 Parent(s): 89ecf4f

Auto-deploy from GitHub: 2fef6d8633615b182a80681c672fbcf252117a51

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -32,7 +32,10 @@ def init_db():
32
  status TEXT NOT NULL,
33
  caption TEXT,
34
  created_at TEXT NOT NULL,
35
- processed_at TEXT)''')
 
 
 
36
  conn.commit()
37
  conn.close()
38
 
@@ -229,12 +232,15 @@ def upload_audio():
229
  filepath = os.path.join(UPLOAD_FOLDER, f"{file_id}_{filename}")
230
  file.save(filepath)
231
 
 
 
 
232
  conn = sqlite3.connect('audio_captions.db')
233
  c = conn.cursor()
234
  c.execute('''INSERT INTO audio_files
235
- (id, filename, filepath, status, created_at)
236
- VALUES (?, ?, ?, ?, ?)''',
237
- (file_id, filename, filepath, 'not_started', datetime.now().isoformat()))
238
  conn.commit()
239
  conn.close()
240
 
@@ -292,7 +298,7 @@ def get_files():
292
  c.execute('''SELECT COUNT(*) as count FROM audio_files WHERE status = 'processing' ''')
293
  processing_count = c.fetchone()['count']
294
 
295
- c.execute('SELECT * FROM audio_files ORDER BY created_at DESC')
296
  rows = c.fetchall()
297
  conn.close()
298
 
 
32
  status TEXT NOT NULL,
33
  caption TEXT,
34
  created_at TEXT NOT NULL,
35
+ processed_at TEXT,
36
+ hide_from_ui INTEGER DEFAULT 0)'''
37
+ )
38
+
39
  conn.commit()
40
  conn.close()
41
 
 
232
  filepath = os.path.join(UPLOAD_FOLDER, f"{file_id}_{filename}")
233
  file.save(filepath)
234
 
235
+ hide_from_ui_str = request.form.get('hide_from_ui', '')
236
+ hide_from_ui_val = 1 if str(hide_from_ui_str).lower() in ['true', '1'] else 0
237
+
238
  conn = sqlite3.connect('audio_captions.db')
239
  c = conn.cursor()
240
  c.execute('''INSERT INTO audio_files
241
+ (id, filename, filepath, status, created_at, hide_from_ui)
242
+ VALUES (?, ?, ?, ?, ?, ?)''',
243
+ (file_id, filename, filepath, 'not_started', datetime.now().isoformat(), hide_from_ui_val))
244
  conn.commit()
245
  conn.close()
246
 
 
298
  c.execute('''SELECT COUNT(*) as count FROM audio_files WHERE status = 'processing' ''')
299
  processing_count = c.fetchone()['count']
300
 
301
+ c.execute('SELECT * FROM audio_files WHERE hide_from_ui = 0 OR hide_from_ui IS NULL ORDER BY created_at DESC')
302
  rows = c.fetchall()
303
  conn.close()
304