🔨(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:
@@ -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 = {
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user