#!/usr/bin/env python3
"""Cari job cron (semua store) yang menyentuh dasindonesia.com."""
import json, os

for p in ["/home/mantapman/.hermes/cron/jobs.json",
          "/home/mantapman/.hermes/profiles/atun/cron/jobs.json"]:
    if not os.path.exists(p):
        continue
    d = json.load(open(p))
    jobs = d if isinstance(d, list) else d.get("jobs", [])
    for j in jobs:
        teks = (str(j.get("prompt") or "") + " " + str(j.get("name") or "") + " " +
                str(j.get("script") or ""))
        if "dasindonesia" in teks.lower() or "das bengkel" in teks.lower() or "das-artikel" in teks.lower():
            sch = j.get("schedule")
            if isinstance(sch, dict):
                sch = sch.get("expr")
            aktif = j.get("enabled") and not j.get("paused")
            print(f"[{p.split('/')[4] if 'profiles' in p else 'default'}] {j.get('id')} | "
                  f"{'AKTIF' if aktif else 'JEDA '} | {sch} | script={j.get('script')} | {j.get('name')}")
            for baris in str(j.get("prompt") or "").splitlines()[:4]:
                if baris.strip():
                    print(f"     {baris[:110]}")
