"""Video-side download SETTINGS (isolated). Persists the video download configuration in video.db's ``video_settings`` KV table — fully separate from the music ``soulseek.*`` paths so the two libraries never share a folder or collide. The actual download fulfillment engine (wishlist → search → grab) is a later roadmap phase; these endpoints just store/serve the config the Settings → Downloads tab edits. Keys persisted here (all under video.db): - ``download_path`` : input folder a video download lands in - ``transfer_path`` : output folder finished video files move to (video library) Connection settings that are genuinely SHARED with music (the slskd instance, the torrent/usenet clients, Prowlarr indexers) are NOT stored here — those live in the music config_manager and are surfaced on the shared Indexers tab + shared slskd block (a deliberate shared boundary, since they're one physical resource). """ from __future__ import annotations from flask import jsonify, request from utils.logging_config import get_logger logger = get_logger("video_api.downloads") # Video-specific path keys (vs. the shared connection settings). _PATH_KEYS = ("download_path", "transfer_path") def register_routes(bp): @bp.route("/downloads/config", methods=["GET"]) def video_downloads_config(): from . import get_video_db db = get_video_db() return jsonify({k: db.get_setting(k) or "" for k in _PATH_KEYS}) @bp.route("/downloads/config", methods=["POST"]) def video_downloads_config_save(): from . import get_video_db db = get_video_db() body = request.get_json(silent=True) or {} for key in _PATH_KEYS: if key in body: db.set_setting(key, (str(body.get(key) or "")).strip()) return jsonify({"status": "saved"})