Initial commit: self-hosted personal radio station
Flask + React web UI with audio player, podcast queue, feed management, episode browser, music library, schedule viewer, and log tail. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
"""SQLite database helpers for the web UI."""
|
||||
|
||||
import sqlite3
|
||||
|
||||
from flask import g
|
||||
|
||||
from .config import DB_PATH
|
||||
|
||||
|
||||
def get_db() -> sqlite3.Connection:
|
||||
if "db" not in g:
|
||||
g.db = sqlite3.connect(str(DB_PATH), timeout=5)
|
||||
g.db.row_factory = sqlite3.Row
|
||||
g.db.execute("PRAGMA journal_mode=WAL")
|
||||
g.db.execute("PRAGMA foreign_keys=ON")
|
||||
g.db.execute("PRAGMA busy_timeout=5000")
|
||||
return g.db
|
||||
|
||||
|
||||
def close_db(e=None):
|
||||
db = g.pop("db", None)
|
||||
if db is not None:
|
||||
db.close()
|
||||
Reference in New Issue
Block a user