feat: add markers/profiles/labels API endpoints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,13 @@
|
|||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
|
|
||||||
|
from core.db import ProcessedDB
|
||||||
|
from .config import DB_PATH
|
||||||
from .routes import files, stream, markers, export, hidden
|
from .routes import files, stream, markers, export, hidden
|
||||||
|
|
||||||
app = FastAPI(title="8-cut Server")
|
app = FastAPI(title="8-cut Server")
|
||||||
|
|
||||||
|
db = ProcessedDB(DB_PATH)
|
||||||
|
|
||||||
app.include_router(files.router, prefix="/api")
|
app.include_router(files.router, prefix="/api")
|
||||||
app.include_router(stream.router, prefix="/api")
|
app.include_router(stream.router, prefix="/api")
|
||||||
app.include_router(markers.router, prefix="/api")
|
app.include_router(markers.router, prefix="/api")
|
||||||
|
|||||||
@@ -1,3 +1,27 @@
|
|||||||
from fastapi import APIRouter
|
from fastapi import APIRouter, Query
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
|
def _db():
|
||||||
|
from ..app import db
|
||||||
|
return db
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/markers/{filename}")
|
||||||
|
def get_markers(filename: str, profile: str = Query("default")):
|
||||||
|
markers = _db().get_markers(filename, profile)
|
||||||
|
return [
|
||||||
|
{"start_time": t, "marker_number": n, "output_path": p}
|
||||||
|
for t, n, p in markers
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/profiles")
|
||||||
|
def get_profiles():
|
||||||
|
return _db().get_profiles()
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/labels")
|
||||||
|
def get_labels():
|
||||||
|
return _db().get_labels()
|
||||||
|
|||||||
Reference in New Issue
Block a user