archive-backend/search/documents.py
2026-11-07 17:27:59 +00:00

15 lines
520 B
Python

from ..models.video_model import Video
def video_to_document(video: Video) -> dict:
return {
"id": video.id,
"title": video.title or video.filename,
"filename": video.filename,
"date": video.date.isoformat() if video.date else None,
"channel_id": video.channel_id,
"channel_name": video.channel.name,
"playlist_id": video.playlist_id,
"playlist_name": video.playlist.name if video.playlist else None,
"preview_path": video.preview_path,
}