mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
* Delete recording with transcript * Delete confirmation dialog * Use aws storage abstraction for recording deletion * Test recording deleted with transcript * Use get transcript storage * Fix the test * Add env vars for recording storage
70 lines
2.2 KiB
Python
70 lines
2.2 KiB
Python
from datetime import datetime
|
|
|
|
import httpx
|
|
|
|
from reflector.db.rooms import Room
|
|
from reflector.settings import settings
|
|
|
|
HEADERS = {
|
|
"Content-Type": "application/json; charset=utf-8",
|
|
"Authorization": f"Bearer {settings.WHEREBY_API_KEY}",
|
|
}
|
|
TIMEOUT = 10 # seconds
|
|
|
|
|
|
async def create_meeting(room_name_prefix: str, end_date: datetime, room: Room):
|
|
data = {
|
|
"isLocked": room.is_locked,
|
|
"roomNamePrefix": room_name_prefix,
|
|
"roomNamePattern": "uuid",
|
|
"roomMode": room.room_mode,
|
|
"endDate": end_date.isoformat(),
|
|
"recording": {
|
|
"type": room.recording_type,
|
|
"destination": {
|
|
"provider": "s3",
|
|
"bucket": settings.RECORDING_STORAGE_AWS_BUCKET_NAME,
|
|
"accessKeyId": settings.AWS_WHEREBY_ACCESS_KEY_ID,
|
|
"accessKeySecret": settings.AWS_WHEREBY_ACCESS_KEY_SECRET,
|
|
"fileFormat": "mp4",
|
|
},
|
|
"startTrigger": room.recording_trigger,
|
|
},
|
|
"fields": ["hostRoomUrl"],
|
|
}
|
|
|
|
async with httpx.AsyncClient() as client:
|
|
response = await client.post(
|
|
f"{settings.WHEREBY_API_URL}/meetings",
|
|
headers=HEADERS,
|
|
json=data,
|
|
timeout=TIMEOUT,
|
|
)
|
|
response.raise_for_status()
|
|
return response.json()
|
|
|
|
|
|
async def get_room_sessions(room_name: str):
|
|
async with httpx.AsyncClient() as client:
|
|
response = await client.get(
|
|
f"{settings.WHEREBY_API_URL}/insights/room-sessions?roomName={room_name}",
|
|
headers=HEADERS,
|
|
timeout=TIMEOUT,
|
|
)
|
|
response.raise_for_status()
|
|
return response.json()
|
|
|
|
|
|
async def upload_logo(room_name: str, logo_path: str):
|
|
async with httpx.AsyncClient() as client:
|
|
with open(logo_path, "rb") as f:
|
|
response = await client.put(
|
|
f"{settings.WHEREBY_API_URL}/rooms{room_name}/theme/logo",
|
|
headers={
|
|
"Authorization": f"Bearer {settings.WHEREBY_API_KEY}",
|
|
},
|
|
timeout=TIMEOUT,
|
|
files={"image": f},
|
|
)
|
|
response.raise_for_status()
|