Add README.md

This commit is contained in:
2025-10-07 20:50:24 +00:00
parent fcc0dfbb0f
commit fc9b3228c4
3 changed files with 446 additions and 1 deletions

View File

@@ -53,6 +53,7 @@ def format_event_with_media(event):
}
# Now you can directly access event.event_media
import logging
if event.event_media:
media = event.event_media
@@ -64,7 +65,39 @@ def format_event_with_media(event):
"auto_advance": True
}
if media.file_path:
# Debug: log media_type
logging.debug(
f"[Scheduler] EventMedia id={media.id} media_type={getattr(media.media_type, 'value', str(media.media_type))}")
# Check for PDF conversion for ppt/pptx/odp
from sqlalchemy.orm import scoped_session
from models.models import Conversion, ConversionStatus
session = scoped_session(Session)
pdf_url = None
if getattr(media.media_type, 'value', str(media.media_type)) in ("ppt", "pptx", "odp"):
conversion = session.query(Conversion).filter_by(
source_event_media_id=media.id,
target_format="pdf",
status=ConversionStatus.ready
).order_by(Conversion.completed_at.desc()).first()
logging.debug(
f"[Scheduler] Conversion lookup for media_id={media.id}: found={bool(conversion)}, path={getattr(conversion, 'target_path', None) if conversion else None}")
if conversion and conversion.target_path:
# Serve via /api/files/converted/<path>
pdf_url = f"{API_BASE_URL}/api/files/converted/{conversion.target_path}"
session.remove()
if pdf_url:
filename = os.path.basename(pdf_url)
event_dict["presentation"]["files"].append({
"name": filename,
"url": pdf_url,
"checksum": None,
"size": None
})
logging.info(
f"[Scheduler] Using converted PDF for event_media_id={media.id}: {pdf_url}")
elif media.file_path:
filename = os.path.basename(media.file_path)
event_dict["presentation"]["files"].append({
"name": filename,
@@ -72,6 +105,8 @@ def format_event_with_media(event):
"checksum": None,
"size": None
})
logging.info(
f"[Scheduler] Using original file for event_media_id={media.id}: {filename}")
# Add other event types...