mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-22 13:19:05 +00:00
update audio-deleted flow
This commit is contained in:
@@ -43,6 +43,10 @@ def range_requests_response(
|
||||
):
|
||||
"""Returns StreamingResponse using Range Requests of a given file"""
|
||||
|
||||
if not os.path.exists(file_path):
|
||||
from fastapi import HTTPException
|
||||
raise HTTPException(status_code=404, detail="File not found")
|
||||
|
||||
file_size = os.stat(file_path).st_size
|
||||
range_header = request.headers.get("range")
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ class GetTranscript(BaseModel):
|
||||
source_kind: SourceKind
|
||||
room_id: str | None = None
|
||||
room_name: str | None = None
|
||||
audio_deleted: bool | None = None
|
||||
|
||||
|
||||
class CreateTranscript(BaseModel):
|
||||
@@ -82,6 +83,7 @@ class UpdateTranscript(BaseModel):
|
||||
share_mode: Optional[Literal["public", "semi-private", "private"]] = Field(None)
|
||||
participants: Optional[list[TranscriptParticipant]] = Field(None)
|
||||
reviewed: Optional[bool] = Field(None)
|
||||
audio_deleted: Optional[bool] = Field(None)
|
||||
|
||||
|
||||
class DeletionStatus(BaseModel):
|
||||
|
||||
@@ -86,8 +86,11 @@ async def transcript_get_audio_mp3(
|
||||
headers=resp.headers,
|
||||
)
|
||||
|
||||
if transcript.audio_deleted:
|
||||
raise HTTPException(status_code=404, detail="Audio unavailable due to privacy settings")
|
||||
|
||||
if not transcript.audio_mp3_filename.exists():
|
||||
raise HTTPException(status_code=500, detail="Audio not found")
|
||||
raise HTTPException(status_code=404, detail="Audio file not found")
|
||||
|
||||
truncated_id = str(transcript.id).split("-")[0]
|
||||
filename = f"recording_{truncated_id}.mp3"
|
||||
|
||||
Reference in New Issue
Block a user