Give the video side its OWN server connection — pre-filled from music but stored separately in video.db, fully isolated (video never writes music config/state). - Effective config helpers (video_plex_config / video_jellyfin_config): video's own creds when set, else inherited read-only from music. resolve_video_server + _build_source + watch-link/poster/dashboard all use these (own db threaded in). - Server Connection UI mirrors music's server picker (toggle = select + configure), scoped to Plex/Jellyfin, at the bottom of the Connections tab. - Jellyfin: independent client built from video's creds; explicit USER picker like music (list users → that user's libraries); honors the pick, admin fallback. - Honest connection diagnostics (reachable vs 401 vs no-users) instead of a vague "auth failed". - Auto-save on change with toasts; the shared Save button is intercepted on the video side so it saves video settings (and can't fire a music save). - Enrichment status now PUSHES over the socket like music (no browser polling / access-log flood); config save only rebuilds workers when an API key changed. - Seam tests for effective-config inheritance/override + isolation guard.
30 lines
1,010 B
Python
30 lines
1,010 B
Python
"""Video dashboard endpoint — live counts from video.db.
|
|
|
|
GET /api/video/dashboard -> {library:{...}, downloads:{...}, watchlist, wishlist}
|
|
With an empty database every value is a real 0.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from flask import jsonify
|
|
|
|
from utils.logging_config import get_logger
|
|
|
|
logger = get_logger("video_api.dashboard")
|
|
|
|
|
|
def register_routes(bp):
|
|
@bp.route("/dashboard", methods=["GET"])
|
|
def video_dashboard():
|
|
from . import get_video_db
|
|
try:
|
|
stats = get_video_db().dashboard_stats()
|
|
try:
|
|
from core.video.sources import resolve_video_server
|
|
stats["server"] = resolve_video_server() # the VIDEO server, not music's active
|
|
except Exception:
|
|
stats["server"] = None
|
|
return jsonify(stats)
|
|
except Exception:
|
|
logger.exception("Failed to build video dashboard stats")
|
|
return jsonify({"error": "Failed to load video dashboard stats"}), 500
|