feat(mcp): validation humaine telegram, apercu mp3, journal tunis (nyora-2026-10-216-b)

This commit is contained in:
bolbol committed 2026-11-02 11:21:09 +01:00
1 parent 5f274df47d
commit 1d6c3a157d
6 files changed
+416 -49

No files matched your search

+14 -2
View File
@@ -3,11 +3,23 @@ import sys
import os
import json
import datetime
from zoneinfo import ZoneInfo
TUNIS_TZ = ZoneInfo("Africa/Tunis")
def get_tunis_date(dt_str: str) -> str:
try:
dt = datetime.datetime.fromisoformat(dt_str)
if dt.tzinfo is None:
dt = dt.replace(tzinfo=datetime.timezone.utc)
return dt.astimezone(TUNIS_TZ).strftime("%Y-%m-%d")
except Exception:
return dt_str[:10]
def count_today(sphere: str, journal_path: str) -> int:
if not os.path.exists(journal_path):
return 0
today = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d")
today = datetime.datetime.now(TUNIS_TZ).strftime("%Y-%m-%d")
count = 0
try:
with open(journal_path, "r", encoding="utf-8") as f:
@@ -19,7 +31,7 @@ def count_today(sphere: str, journal_path: str) -> int:
entry = json.loads(line)
if entry.get("sphere") == sphere:
entry_date = entry.get("date", "")
if entry_date.startswith(today):
if get_tunis_date(entry_date) == today:
count += 1
except Exception:
continue