Skip to content

Commit c048b15

Browse files
committed
Add start and stop camera, update status -> action in update status endpoints
1 parent a3c9b15 commit c048b15

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

videodb/rtstream.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ def get_scenes(self, start: int = None, end: int = None, page=1, page_size=100):
4848
def start(self):
4949
self._connection.patch(
5050
f"{ApiPath.rtstream}/{self.rtstream_id}/{ApiPath.index}/{ApiPath.scene}/{self.rtstream_index_id}/{ApiPath.status}",
51-
data={"status": "running"},
51+
data={"action": "start"},
5252
)
53-
self.status = "running"
53+
self.status = "connected"
5454

5555
def stop(self):
5656
self._connection.patch(
5757
f"{ApiPath.rtstream}/{self.rtstream_id}/{ApiPath.index}/{ApiPath.scene}/{self.rtstream_index_id}/{ApiPath.status}",
58-
data={"status": "stopped"},
58+
data={"action": "stop"},
5959
)
6060
self.status = "stopped"
6161

@@ -109,6 +109,20 @@ def __repr__(self) -> str:
109109
f"status={self.status})"
110110
)
111111

112+
def start(self):
113+
self._connection.patch(
114+
f"{ApiPath.rtstream}/{self.id}/{ApiPath.status}",
115+
data={"action": "start"},
116+
)
117+
self.status = "connected"
118+
119+
def stop(self):
120+
self._connection.patch(
121+
f"{ApiPath.rtstream}/{self.id}/{ApiPath.status}",
122+
data={"action": "stop"},
123+
)
124+
self.status = "stopped"
125+
112126
def generate_stream(self, start, end):
113127
stream_data = self._connection.get(
114128
f"{ApiPath.rtstream}/{self.id}/{ApiPath.stream}",

0 commit comments

Comments
 (0)