🔨(summary) add egress manifest in summary

Add the possibility of getting egress manifest by sending the
worker id in the notification.
This will allow us to get the starting time of the recording
to be able to align perfectly the metadatas and the transcription.
This commit is contained in:
Martin Guitteny
2025-10-10 11:26:07 +02:00
parent a02bea4911
commit f7ba2ccafe
3 changed files with 19 additions and 1 deletions
@@ -132,6 +132,8 @@ class NotificationService:
logger.error("No owner found for recording %s", recording.id)
return False
worker_id = recording.worker_id
payload = {
"filename": recording.key,
"email": owner_access.user.email,
@@ -143,6 +145,7 @@ class NotificationService:
"recording_time": recording.created_at.astimezone(
owner_access.user.timezone
).strftime("%H:%M"),
"worker_id": worker_id,
}
headers = {
+2 -1
View File
@@ -25,7 +25,7 @@ class TaskCreation(BaseModel):
room: Optional[str]
recording_date: Optional[str]
recording_time: Optional[str]
worker_id: Optional[str]
router = APIRouter(prefix="/tasks")
@@ -42,6 +42,7 @@ async def create_task(request: TaskCreation):
request.room,
request.recording_date,
request.recording_time,
request.worker_id,
],
queue=settings.transcribe_queue,
)
+14
View File
@@ -313,6 +313,7 @@ def process_audio_transcribe_summarize_v2( # noqa: PLR0915
room: Optional[str],
recording_date: Optional[str],
recording_time: Optional[str],
worker_id: Optional[str],
):
"""Process an audio file by transcribing it and generating a summary.
@@ -398,15 +399,28 @@ def process_audio_transcribe_summarize_v2( # noqa: PLR0915
object_name=settings.metadata_file.format(filename=file),
)
file_manifest = "recordings/"+ worker_id + ".json"
manifest_obj = minio_client.get_object(
settings.aws_storage_bucket_name,
object_name=file_manifest,
)
logger.info("Manifest file downloaded: %s", file_manifest)
logger.info("Downloading metadata file")
try:
metadata_bytes = metadata_obj.read()
metadata_json = json.loads(metadata_bytes.decode("utf-8"))
manifest_bytes = manifest_obj.read()
manifest_json = json.loads(manifest_bytes.decode("utf-8"))
finally:
metadata_obj.close()
metadata_obj.release_conn()
manifest_obj.close()
manifest_obj.release_conn()
logger.info("Metadata file successfully downloaded")
logger.debug("Manifest: %s", manifest_json)
formatted_transcription = (
DEFAULT_EMPTY_TRANSCRIPTION
if not getattr(transcription, "segments", None)