Skip to content

Commit bd1ae9a

Browse files
committed
Fix docstring type and add status in constant
1 parent b8d7833 commit bd1ae9a

File tree

3 files changed

+55
-33
lines changed

3 files changed

+55
-33
lines changed

videodb/_constants.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ class Status:
9191
in_progress = "in progress"
9292

9393

94+
class MeetingStatus:
95+
initializing = "initializing"
96+
processing = "processing"
97+
done = "done"
98+
99+
94100
class HttpClientDefaultValues:
95101
max_retries = 1
96102
timeout = 30

videodb/meeting.py

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
from videodb._constants import ApiPath
1+
from videodb._constants import ApiPath, MeetingStatus
22

33
from videodb.exceptions import (
44
VideodbError,
55
)
66

77

88
class Meeting:
9-
"""Meeting class representing a meeting recording bot."""
9+
"""Meeting class representing a meeting recording bot.
10+
11+
:ivar str id: Unique identifier for the meeting
12+
:ivar str collection_id: ID of the collection this meeting belongs to
13+
:ivar str bot_name: Name of the meeting recording bot
14+
:ivar str name: Name of the meeting
15+
:ivar str meeting_url: URL of the meeting
16+
:ivar str status: Current status of the meeting
17+
:ivar str time_zone: Time zone of the meeting
18+
:ivar str video_id: ID of the recorded video
19+
:ivar dict speaker_timeline: Timeline of speakers in the meeting
20+
"""
1021

1122
def __init__(self, _connection, id: str, collection_id: str, **kwargs) -> None:
1223
self._connection = _connection
@@ -18,7 +29,12 @@ def __repr__(self) -> str:
1829
return f"Meeting(id={self.id}, collection_id={self.collection_id}, name={self.name}, status={self.status}, bot_name={self.bot_name})"
1930

2031
def _update_attributes(self, data: dict) -> None:
21-
"""Update instance attributes from API response data."""
32+
"""Update instance attributes from API response data.
33+
34+
:param dict data: Dictionary containing attribute data from API response
35+
:return: None
36+
:rtype: None
37+
"""
2238
self.bot_name = data.get("bot_name")
2339
self.name = data.get("meeting_name")
2440
self.meeting_url = data.get("meeting_url")
@@ -30,11 +46,9 @@ def _update_attributes(self, data: dict) -> None:
3046
def refresh(self) -> "Meeting":
3147
"""Refresh meeting data from the server.
3248
33-
Returns:
34-
self: The Meeting instance with updated data
35-
36-
Raises:
37-
APIError: If the API request fails
49+
:return: The Meeting instance with updated data
50+
:rtype: Meeting
51+
:raises VideodbError: If the API request fails
3852
"""
3953
response = self._connection.get(
4054
path=f"{ApiPath.collection}/{self.collection_id}/{ApiPath.meeting}/{self.id}"
@@ -49,26 +63,32 @@ def refresh(self) -> "Meeting":
4963

5064
@property
5165
def is_active(self) -> bool:
52-
"""Check if the meeting is currently active."""
53-
return self.status in ["initializing", "processing"]
66+
"""Check if the meeting is currently active.
67+
68+
:return: True if meeting is initializing or processing, False otherwise
69+
:rtype: bool
70+
"""
71+
return self.status in [MeetingStatus.initializing, MeetingStatus.processing]
5472

5573
@property
5674
def is_completed(self) -> bool:
57-
"""Check if the meeting has completed."""
58-
return self.status in ["done"]
75+
"""Check if the meeting has completed.
76+
77+
:return: True if meeting is done, False otherwise
78+
:rtype: bool
79+
"""
80+
return self.status == MeetingStatus.done
5981

6082
def wait_for_status(
6183
self, target_status: str, timeout: int = 14400, interval: int = 120
6284
) -> bool:
6385
"""Wait for the meeting to reach a specific status.
6486
65-
Args:
66-
target_status: The status to wait for
67-
timeout: Maximum time to wait in seconds
68-
interval: Time between status checks in seconds
69-
70-
Returns:
71-
bool: True if status reached, False if timeout
87+
:param str target_status: The status to wait for
88+
:param int timeout: Maximum time to wait in seconds (default: 14400)
89+
:param int interval: Time between status checks in seconds (default: 120)
90+
:return: True if status reached, False if timeout
91+
:rtype: bool
7292
"""
7393
import time
7494

videodb/video.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -619,18 +619,14 @@ def get_meeting(self):
619619
# TODO: Add type check for Meeting
620620
from videodb.meeting import Meeting
621621

622-
try:
623-
meeting_data = self._connection.get(
624-
path=f"{ApiPath.video}/{self.id}/{ApiPath.meeting}"
622+
meeting_data = self._connection.get(
623+
path=f"{ApiPath.video}/{self.id}/{ApiPath.meeting}"
624+
)
625+
if meeting_data:
626+
return Meeting(
627+
self._connection,
628+
id=meeting_data.get("meeting_id"),
629+
collection_id=self.collection_id,
630+
**meeting_data,
625631
)
626-
if meeting_data:
627-
return Meeting(
628-
self._connection,
629-
id=meeting_data.get("meeting_id"),
630-
collection_id=self.collection_id,
631-
**meeting_data,
632-
)
633-
return None
634-
except Exception:
635-
# Return None if no meeting is associated or API call fails
636-
return None
632+
return None

0 commit comments

Comments
 (0)