From 934ac899ce816f0ee9ef5dfd38ace964cf48d5b5 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Thu, 18 Jun 2026 22:42:25 +0200 Subject: [PATCH] =?UTF-8?q?VG-Wort:=20Z=C3=A4hlmarke=20NUR=20bei=20state?= =?UTF-8?q?=3D1=20(live)=20verbrauchen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - if state == 1 → Zählmarke aus Pool holen + Pixel einbauen - Korrektur (state=0) → KEINE Zählmarke, Log-Meldung 'Übersprungen' - Pool: 19/20 verfügbar (1 korrekt für Live-Test verbraucht) --- article_server.py | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/article_server.py b/article_server.py index 1efabc5..ea23202 100644 --- a/article_server.py +++ b/article_server.py @@ -949,25 +949,30 @@ h1{color:#c0392b;}p{color:#888;} alias = re.sub(r'[^a-z0-9]+', '-', title.lower().strip())[:100] # ── VG-Wort Zählmarke aus Pool holen & einbauen ───────── + # NUR bei LIVE-Artikeln (state=1)! Korrektur verbraucht keine Zählmarke. vgwort_pixel_html = "" - try: - import subprocess - result = subprocess.run( - ["python3", os.path.expanduser("~/.hermes/vgwort_pool.py"), "get"], - capture_output=True, text=True, timeout=30 - ) - if result.returncode == 0: - pixel_data = json.loads(result.stdout) - if pixel_data.get("ok"): - vgwort_pixel_html = pixel_data.get("pixel_html", "") - print(f"[VG-Wort] Zählmarke {pixel_data.get('public_id')} eingebaut, " - f"Pool: {pixel_data.get('pool_remaining')} übrig", flush=True) + if state == 1: + try: + import subprocess + result = subprocess.run( + ["python3", os.path.expanduser("~/.hermes/vgwort_pool.py"), "get"], + capture_output=True, text=True, timeout=30 + ) + if result.returncode == 0: + pixel_data = json.loads(result.stdout) + if pixel_data.get("ok"): + vgwort_pixel_html = pixel_data.get("pixel_html", "") + print(f"[VG-Wort] Zählmarke {pixel_data.get('public_id')} eingebaut, " + f"Pool: {pixel_data.get('pool_remaining')} übrig", flush=True) + else: + print(f"[VG-Wort] FEHLER: {pixel_data.get('error', 'unbekannt')}", flush=True) else: - print(f"[VG-Wort] FEHLER: {pixel_data.get('error', 'unbekannt')}", flush=True) - else: - print(f"[VG-Wort] Pool-Script fehlgeschlagen: {result.stderr}", flush=True) - except Exception as e: - print(f"[VG-Wort] Ausnahme: {e}", flush=True) + print(f"[VG-Wort] Pool-Script fehlgeschlagen: {result.stderr}", flush=True) + except Exception as e: + print(f"[VG-Wort] Ausnahme: {e}", flush=True) + else: + print(f"[VG-Wort] Übersprungen — Artikel geht auf Korrektur (state=0), " + f"Zählmarke erst bei Live-Gang", flush=True) if vgwort_pixel_html: if '' in article_body: