diff --git a/api/video/enrichment.py b/api/video/enrichment.py index e3e50bde..59f6b8bd 100644 --- a/api/video/enrichment.py +++ b/api/video/enrichment.py @@ -46,8 +46,16 @@ def register_routes(bp): "tmdb_api_key": db.get_setting("tmdb_api_key") or "", "tvdb_api_key": db.get_setting("tvdb_api_key") or "", "omdb_api_key": db.get_setting("omdb_api_key") or "", + "billboard_autoplay": (db.get_setting("billboard_autoplay") or "1") == "1", }) + @bp.route("/prefs", methods=["GET"]) + def video_prefs(): + # Lightweight UI prefs for the detail page (no API keys). + from . import get_video_db + db = get_video_db() + return jsonify({"billboard_autoplay": (db.get_setting("billboard_autoplay") or "1") == "1"}) + @bp.route("/enrichment/config", methods=["POST"]) def video_enrichment_config_save(): from . import get_video_db @@ -57,6 +65,8 @@ def register_routes(bp): db.set_setting("tmdb_api_key", body.get("tmdb_api_key") or "") if "tvdb_api_key" in body: db.set_setting("tvdb_api_key", body.get("tvdb_api_key") or "") + if "billboard_autoplay" in body: + db.set_setting("billboard_autoplay", "1" if body.get("billboard_autoplay") else "0") if "omdb_api_key" in body: new_key = body.get("omdb_api_key") or "" changed = new_key != (db.get_setting("omdb_api_key") or "") diff --git a/tests/test_video_api.py b/tests/test_video_api.py index 1d8504b6..043a5135 100644 --- a/tests/test_video_api.py +++ b/tests/test_video_api.py @@ -267,12 +267,14 @@ def test_enrichment_config_save_load(tmp_path, monkeypatch): client = app.test_client() try: assert client.get("/api/video/enrichment/config").get_json() == { - "tmdb_api_key": "", "tvdb_api_key": "", "omdb_api_key": ""} + "tmdb_api_key": "", "tvdb_api_key": "", "omdb_api_key": "", "billboard_autoplay": True} client.post("/api/video/enrichment/config", - json={"tmdb_api_key": "abc", "tvdb_api_key": "xyz", "omdb_api_key": "om"}) + json={"tmdb_api_key": "abc", "tvdb_api_key": "xyz", "omdb_api_key": "om", + "billboard_autoplay": False}) assert client.get("/api/video/enrichment/config").get_json() == { - "tmdb_api_key": "abc", "tvdb_api_key": "xyz", "omdb_api_key": "om"} + "tmdb_api_key": "abc", "tvdb_api_key": "xyz", "omdb_api_key": "om", "billboard_autoplay": False} assert db.get_setting("tmdb_api_key") == "abc" and db.get_setting("omdb_api_key") == "om" + assert client.get("/api/video/prefs").get_json() == {"billboard_autoplay": False} finally: videoapi._video_db = None diff --git a/webui/index.html b/webui/index.html index 1d22df30..76b458e2 100644 --- a/webui/index.html +++ b/webui/index.html @@ -5191,6 +5191,22 @@ +