Explorer
/tmp/patch_template.py
← Zurück ↓ Download
from pathlib import Path
p=Path('/opt/struktur/social-media-agent/templates/cockpit.html')
s=p.read_text()
s=s.replace('''      <div>Veröffentlicht: {{ s.published_at or "unbekannt" }}</div>\n      <div>Gefunden: {{ s.observed_at or s.created_at }}</div>\n''','''      {% if s.source_type == 'meta_ad' %}\n      <div>Gestartet: {{ s.ad_start_at or s.published_at or "unbekannt" }}</div>\n      <div>Zuletzt aktiv bestätigt: {{ s.last_seen_at or "unbekannt" }}</div>\n      <div>Status: {{ (s.active_status or "unknown")|upper }}</div>\n      {% else %}\n      <div>Veröffentlicht: {{ s.published_at or "unbekannt" }}</div>\n      <div>Gefunden: {{ s.observed_at or s.created_at }}</div>\n      {% endif %}\n''',1)
s=s.replace("('linkedin','LI · Quelle'),('facebook','FB · Quelle')", "('linkedin','LI · Filter'),('facebook','FB · Filter')")
p.write_text(s)