Skip to content

Commit 999081b

Browse files
committed
add docstrings for missing functions
1 parent b7d7a66 commit 999081b

File tree

1 file changed

+56
-14
lines changed

1 file changed

+56
-14
lines changed

videodb/video.py

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def search(
6464
:param str query: Query to search for
6565
:param SearchType search_type:(optional) Type of search to perform :class:`SearchType <SearchType>` object
6666
:param IndexType index_type:(optional) Type of index to search :class:`IndexType <IndexType>` object
67-
:param str index_id: (optional) Index ID of scene index to search
6867
:param int result_threshold:(optional) Number of results to return
6968
:param float score_threshold:(optional) Threshold score for the search
7069
:param float dynamic_score_percentage:(optional) Percentage of dynamic score to consider
@@ -95,6 +94,12 @@ def delete(self) -> None:
9594
self._connection.delete(path=f"{ApiPath.video}/{self.id}")
9695

9796
def remove_storage(self) -> None:
97+
"""Remove the video storage.
98+
99+
:raises InvalidRequestError: If the storage removal fails
100+
:return: None if the removal is successful
101+
:rtype: None
102+
"""
98103
self._connection.delete(path=f"{ApiPath.video}/{self.id}/{ApiPath.storage}")
99104

100105
def generate_stream(self, timeline: Optional[List[Tuple[int, int]]] = None) -> str:
@@ -188,15 +193,20 @@ def get_transcript(
188193
self,
189194
start: int = None,
190195
end: int = None,
191-
segmenter: str = Segmenter.word,
196+
segmenter: Segmenter = Segmenter.word,
192197
length: int = 1,
193198
force: bool = None,
194-
) -> List[Dict]:
195-
"""Get the transcript of the video.
196-
197-
:param bool force: (optional) Force to fetch the transcript
198-
:return: The transcript of the video
199-
:rtype: list[dict]
199+
) -> List[Dict[str, Union[float, str]]]:
200+
"""Get timestamped transcript segments for the video.
201+
202+
:param int start: Start time in seconds
203+
:param int end: End time in seconds
204+
:param Segmenter segmenter: Segmentation type (:class:`Segmenter.word`,
205+
:class:`Segmenter.sentence`, :class:`Segmenter.time`)
206+
:param int length: Length of segments when using time segmenter
207+
:param bool force: Force fetch new transcript
208+
:return: List of dicts with keys: start (float), end (float), text (str)
209+
:rtype: List[Dict[str, Union[float, str]]]
200210
"""
201211
self._fetch_transcript(
202212
start=start, end=end, segmenter=segmenter, length=length, force=force
@@ -211,10 +221,12 @@ def get_transcript_text(
211221
length: int = 1,
212222
force: bool = None,
213223
) -> str:
214-
"""Get the transcript text of the video.
224+
"""Get plain text transcript for the video.
215225
216-
:param bool force: (optional) Force to fetch the transcript
217-
:return: The transcript text of the video
226+
:param int start: Start time in seconds to get transcript from
227+
:param int end: End time in seconds to get transcript until
228+
:param bool force: Force fetch new transcript
229+
:return: Full transcript text as string
218230
:rtype: str
219231
"""
220232
self._fetch_transcript(
@@ -249,7 +261,11 @@ def index_spoken_words(
249261
)
250262

251263
def get_scenes(self) -> Union[list, None]:
252-
"""Get the scenes of the video.
264+
"""
265+
.. deprecated:: 0.2.0
266+
Use :func:`list_scene_index` and :func:`get_scene_index` instead.
267+
268+
Get the scenes of the video.
253269
254270
:return: The scenes of the video
255271
:rtype: list
@@ -309,7 +325,20 @@ def extract_scenes(
309325
"""Extract the scenes of the video.
310326
311327
:param SceneExtractionType extraction_type: (optional) The type of extraction, :class:`SceneExtractionType <SceneExtractionType>` object
312-
:param dict extraction_config: (optional) The configuration for the extraction
328+
:param dict extraction_config: (optional) Dictionary of configuration parameters to control how scenes are extracted.
329+
For time-based extraction (extraction_type=time_based):
330+
- "time" (int, optional): Interval in seconds at which scenes are segmented.
331+
Default is 10 (i.e., every 10 seconds forms a new scene).
332+
- "frame_count" (int, optional): Number of frames to extract per scene.
333+
Default is 1.
334+
- "select_frames" (List[str], optional): Which frames to select from each segment.
335+
Possible values include "first", "middle", and "last". Default is ["first"].
336+
337+
For shot-based extraction (extraction_type=shot_based):
338+
- "threshold" (int, optional): Sensitivity for detecting scene changes (camera shots).
339+
The higher the threshold, the fewer scene splits. Default is 20.
340+
- "frame_count" (int, optional): Number of frames to extract from each detected shot.
341+
Default is 1.
313342
:param bool force: (optional) Force to extract the scenes
314343
:param str callback_url: (optional) URL to receive the callback
315344
:raises InvalidRequestError: If the extraction fails
@@ -387,7 +416,20 @@ def index_scenes(
387416
"""Index the scenes of the video.
388417
389418
:param SceneExtractionType extraction_type: (optional) The type of extraction, :class:`SceneExtractionType <SceneExtractionType>` object
390-
:param dict extraction_config: (optional) The configuration for the extraction
419+
:param dict extraction_config: (optional) Dictionary of configuration parameters to control how scenes are extracted.
420+
For time-based extraction (extraction_type=time_based):
421+
- "time" (int, optional): Interval in seconds at which scenes are segmented.
422+
Default is 10 (i.e., every 10 seconds forms a new scene).
423+
- "frame_count" (int, optional): Number of frames to extract per scene.
424+
Default is 1.
425+
- "select_frames" (List[str], optional): Which frames to select from each segment.
426+
Possible values include "first", "middle", and "last". Default is ["first"].
427+
428+
For shot-based extraction (extraction_type=shot_based):
429+
- "threshold" (int, optional): Sensitivity for detecting scene changes (camera shots).
430+
The higher the threshold, the fewer scene splits. Default is 20.
431+
- "frame_count" (int, optional): Number of frames to extract from each detected shot.
432+
Default is 1.
391433
:param str prompt: (optional) The prompt for the extraction
392434
:param str model_name: (optional) The model name for the extraction
393435
:param dict model_config: (optional) The model configuration for the extraction

0 commit comments

Comments
 (0)