From 72fab16badb5de103337fc699c939e042c24e3cb Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:58:22 -0700 Subject: [PATCH] Add POST /api/wishlist/process endpoint for external API access Allows external apps to trigger wishlist processing without needing to look up automation IDs. Returns 409 if already running. Uses the same _process_wishlist_automatically function as the automation engine. --- web_server.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/web_server.py b/web_server.py index db3e88c6..a21dea3f 100644 --- a/web_server.py +++ b/web_server.py @@ -20239,6 +20239,22 @@ def get_database_stats(): print(f"Error getting database stats: {e}") return jsonify({"error": str(e)}), 500 +@app.route('/api/wishlist/process', methods=['POST']) +def process_wishlist_api(): + """Trigger wishlist processing via API. Processes pending wishlist tracks in the background.""" + try: + if wishlist_auto_processing: + return jsonify({"success": False, "error": "Wishlist processing already in progress"}), 409 + + # Run in background thread (same as automation trigger) + import threading + thread = threading.Thread(target=_process_wishlist_automatically, daemon=True) + thread.start() + + return jsonify({"success": True, "message": "Wishlist processing started"}) + except Exception as e: + return jsonify({"success": False, "error": str(e)}), 500 + @app.route('/api/wishlist/count', methods=['GET']) def get_wishlist_count(): """Endpoint to get current wishlist count."""