- Клиент Novofon DATA API (JSON-RPC, get.calls_report, чанки по 90 дней) - faster-whisper (модель turbo) на CUDA с разделением стереоканалов - Маркировка спикеров: левый канал = caller, правый = callee - Directus: коллекции calls, calls_74951284933, contacts - CLI: process, process-file, export, daemon (polling 5 мин) - Docker Compose для Directus + PostgreSQL - Архив email-парсинга в old/
24 lines
704 B
Python
24 lines
704 B
Python
import json
|
|
from storage.directus import DirectusClient
|
|
|
|
|
|
def export_to_json(filepath: str):
|
|
calls = _export_from_directus()
|
|
with open(filepath, "w", encoding="utf-8") as f:
|
|
json.dump(calls, f, ensure_ascii=False, indent=2, default=str)
|
|
|
|
|
|
def _export_from_directus() -> list[dict]:
|
|
try:
|
|
dc = DirectusClient()
|
|
if not dc.is_available():
|
|
return []
|
|
all_calls = []
|
|
for col in ["calls", "calls_74951284933"]:
|
|
resp = dc._client.get(f"/items/{col}")
|
|
if resp.status_code == 200:
|
|
all_calls.extend(resp.json().get("data", []))
|
|
dc.close()
|
|
return all_calls
|
|
except Exception:
|
|
return []
|