Skip to content

Commit 7036ece

Browse files
committed
Index Interface Updates
- Deleted old scene_index and replaced with renaming new create_scene_index - Added missing prompt - Synced name of scene_collection[s] with server - Replaced delete_scene_index with renaming new delete_index
1 parent c4a922e commit 7036ece

File tree

1 file changed

+8
-32
lines changed

1 file changed

+8
-32
lines changed

videodb/video.py

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -161,22 +161,6 @@ def index_spoken_words(
161161
show_progress=True,
162162
)
163163

164-
def index_scenes(
165-
self,
166-
force: bool = False,
167-
prompt: str = None,
168-
callback_url: str = None,
169-
) -> None:
170-
self._connection.post(
171-
path=f"{ApiPath.video}/{self.id}/{ApiPath.index}",
172-
data={
173-
"index_type": IndexType.scene,
174-
"force": force,
175-
"prompt": prompt,
176-
"callback_url": callback_url,
177-
},
178-
)
179-
180164
def get_scenes(self) -> Union[list, None]:
181165
if self.scenes:
182166
return self.scenes
@@ -216,7 +200,7 @@ def _format_scene_collection(self, collection_data: dict) -> SceneCollection:
216200

217201
return SceneCollection(
218202
self._connection,
219-
collection_data.get("scenes_collection_id"),
203+
collection_data.get("scene_collection_id"),
220204
self.id,
221205
collection_data.get("config", {}),
222206
scenes,
@@ -232,36 +216,36 @@ def extract_scenes(
232216
scenes_data = self._connection.post(
233217
path=f"{ApiPath.video}/{self.id}/{ApiPath.scenes}",
234218
data={
235-
"index_type": IndexType.scene,
236219
"extraction_type": extraction_type,
237220
"extraction_config": extraction_config,
238221
"force": force,
239222
"callback_url": callback_url,
240223
},
241224
)
242-
return self._format_scene_collection(scenes_data.get("scenes_collection"))
225+
return self._format_scene_collection(scenes_data.get("scene_collection"))
243226

244227
def get_scene_collection(self, collection_id: str):
245228
scenes_data = self._connection.get(
246229
path=f"{ApiPath.video}/{self.id}/{ApiPath.scenes}/{collection_id}"
247230
)
248-
return self._format_scene_collection(scenes_data.get("scenes_collection"))
231+
return self._format_scene_collection(scenes_data.get("scene_collection"))
249232

250233
def get_scene_collections(self):
251234
scene_collections_data = self._connection.get(
252235
path=f"{ApiPath.video}/{self.id}/{ApiPath.scenes}"
253236
)
254-
return scene_collections_data.get("scenes_collections", [])
237+
return scene_collections_data.get("scene_collections", [])
255238

256239
def delete_scene_collection(self, collection_id: str) -> None:
257240
self._connection.delete(
258241
path=f"{ApiPath.video}/{self.id}/{ApiPath.scenes}/{collection_id}"
259242
)
260243

261-
def create_scene_index(
244+
def index_scenes(
262245
self,
263246
extraction_type: SceneExtractionType = SceneExtractionType.scene,
264247
extraction_config: dict = {},
248+
prompt: str = None,
265249
scenes: List[Scene] = [],
266250
force: bool = False,
267251
callback_url: str = None,
@@ -272,6 +256,7 @@ def create_scene_index(
272256
"scenes": [scene.to_json() for scene in scenes],
273257
"extraction_type": extraction_type,
274258
"extraction_config": extraction_config,
259+
"prompt": prompt,
275260
"force": force,
276261
"callback_url": callback_url,
277262
},
@@ -291,20 +276,11 @@ def get_scene_index(self, scene_index_id: str) -> Scene:
291276
)
292277
return index_data.get("scene_index_records", [])
293278

294-
def delete_index(self, scene_index_id: str) -> None:
279+
def delete_scene_index(self, scene_index_id: str) -> None:
295280
self._connection.delete(
296281
path=f"{ApiPath.video}/{self.id}/{ApiPath.index}/{ApiPath.scene}/{scene_index_id}"
297282
)
298283

299-
def delete_scene_index(self) -> None:
300-
self._connection.post(
301-
path=f"{ApiPath.video}/{self.id}/{ApiPath.index}/{ApiPath.delete}",
302-
data={
303-
"index_type": IndexType.scene,
304-
},
305-
)
306-
self.scenes = None
307-
308284
def add_subtitle(self, style: SubtitleStyle = SubtitleStyle()) -> str:
309285
if not isinstance(style, SubtitleStyle):
310286
raise ValueError("style must be of type SubtitleStyle")

0 commit comments

Comments
 (0)