#!/usr/bin/env python3
"""
Script per estrarre PDF dall'EML sul droplet.
ESEGUIRE SUL DROPLET: docker exec iris-mcp-server python3 /opt/iris/extract_pdf.py
"""
import sys
import os
# Aggiungo path per importare file_utils
sys.path.insert(0, '/opt/iris/src/mcp_servers/microsoft/operations')
from file_utils import extract_pdf_from_eml
# Path dell'EML sul droplet
eml_path = "/app/attachments/20251023_064811_postacert.eml"
output_dir = "/app/attachments"
print(f"π Estraendo PDF da: {eml_path}")
# Estrai PDF
pdf_path = extract_pdf_from_eml(eml_path, output_dir)
if pdf_path:
print(f"β PDF estratto con successo!")
print(f"π Path: {pdf_path}")
# Stampo SOLO il path per facilit parsing
print(f"PATH:{pdf_path}")
else:
print("β Nessun PDF trovato nell'EML")
sys.exit(1)