Skip to content

Commit 4261ea9

Browse files
authored
Merge pull request #58 from video-db/add-rt-meeting-support
Add rt meeting support
2 parents f4bf275 + 2e7a564 commit 4261ea9

4 files changed

Lines changed: 47 additions & 2 deletions

File tree

videodb/_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class Status:
107107
class MeetingStatus:
108108
initializing = "initializing"
109109
processing = "processing"
110+
joined = "joined"
110111
done = "done"
111112

112113

videodb/collection.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def delete_image(self, image_id: str) -> None:
167167
)
168168

169169
def connect_rtstream(
170-
self, url: str, name: str, sample_rate: int = None
170+
self, url: str, name: str, sample_rate: int = None, audio: bool = False
171171
) -> RTStream:
172172
"""Connect to an rtstream.
173173
@@ -182,6 +182,7 @@ def connect_rtstream(
182182
"collection_id": self.id,
183183
"url": url,
184184
"name": name,
185+
"audio": audio,
185186
"sample_rate": sample_rate,
186187
},
187188
)
@@ -520,6 +521,7 @@ def record_meeting(
520521
bot_name: str = None,
521522
bot_image_url: str = None,
522523
meeting_title: str = None,
524+
realtime_stream: bool = False,
523525
callback_url: str = None,
524526
callback_data: Optional[dict] = None,
525527
time_zone: str = "UTC",
@@ -530,6 +532,7 @@ def record_meeting(
530532
:param str bot_name: Name of the recorder bot
531533
:param str bot_image_url: URL of the recorder bot image
532534
:param str meeting_title: Name of the meeting
535+
:param bool realtime_stream: Whether to stream the meeting in realtime
533536
:param str callback_url: URL to receive callback once recording is done
534537
:param dict callback_data: Data to be sent in the callback (optional)
535538
:param str time_zone: Time zone for the meeting (default ``UTC``)
@@ -546,6 +549,7 @@ def record_meeting(
546549
"bot_name": bot_name,
547550
"bot_image_url": bot_image_url,
548551
"meeting_title": meeting_title,
552+
"realtime_stream": realtime_stream,
549553
"callback_url": callback_url,
550554
"callback_data": callback_data,
551555
"time_zone": time_zone,

videodb/meeting.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def _update_attributes(self, data: dict) -> None:
4545
self.time_zone = data.get("time_zone")
4646
self.video_id = data.get("video_id")
4747
self.speaker_timeline = data.get("speaker_timeline")
48+
self.realtime_stream = data.get("realtime_stream")
49+
self.realtime_stream_url = data.get("realtime_stream_url")
4850

4951
def refresh(self) -> "Meeting":
5052
"""Refresh meeting data from the server.
@@ -106,4 +108,4 @@ def wait_for_status(
106108
return True
107109
time.sleep(interval)
108110

109-
return False
111+
return False

videodb/rtstream.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,41 @@ def get_scene_index(self, index_id: str) -> RTStreamSceneIndex:
299299
name=index_data.get("name"),
300300
status=index_data.get("status"),
301301
)
302+
303+
def get_transcript(
304+
self,
305+
page=1,
306+
page_size=100,
307+
start=None,
308+
end=None,
309+
since=None,
310+
engine=None,
311+
):
312+
"""Get transcription data from the rtstream.
313+
314+
:param int page: Page number (default: 1)
315+
:param int page_size: Items per page (default: 100, max: 1000)
316+
:param float start: Start timestamp filter (optional)
317+
:param float end: End timestamp filter (optional)
318+
:param float since: For polling - only get transcriptions after this timestamp (optional)
319+
:param str engine: Transcription engine (default: "AAIS")
320+
:return: Transcription data with segments and metadata
321+
:rtype: dict
322+
"""
323+
params = {
324+
"engine": engine,
325+
"page": page,
326+
"page_size": page_size,
327+
}
328+
if start is not None:
329+
params["start"] = start
330+
if end is not None:
331+
params["end"] = end
332+
if since is not None:
333+
params["since"] = since
334+
335+
transcription_data = self._connection.get(
336+
f"{ApiPath.rtstream}/{self.id}/{ApiPath.transcription}",
337+
params=params,
338+
)
339+
return transcription_data

0 commit comments

Comments
 (0)