import requests
import json
from config import MISTY_IP 

def post(path, payload=None):
    
    url = f"http://{MISTY_IP}{path}"
    r = requests.post(
        url,
        data=json.dumps(payload or {}),
        headers={"Content-Type": "application/json"},
        timeout=5
    )
    print(f"{path} -> {r.status_code}")
    try:
        print(r.json())
    except Exception:
        print(r.text)

print(f"🛑 Stoppe AV Streaming auf {MISTY_IP}...")
post("/api/avstreaming/stop")

print("\n🔌 Deaktiviere AV Streaming Service...")
post("/api/services/avstreaming/disable")

print("\n✅ Misty AV-Streaming vollständig beendet.")
