diff --git a/videodb/__about__.py b/videodb/__about__.py index bc4492a..8947bf1 100644 --- a/videodb/__about__.py +++ b/videodb/__about__.py @@ -1,7 +1,7 @@ """ About information for videodb sdk""" -__version__ = "0.2.3" +__version__ = "0.2.4" __title__ = "videodb" __author__ = "videodb" __email__ = "contact@videodb.io" diff --git a/videodb/__init__.py b/videodb/__init__.py index 7aa45a7..6f13816 100644 --- a/videodb/__init__.py +++ b/videodb/__init__.py @@ -11,6 +11,7 @@ SceneExtractionType, MediaType, SearchType, + Segmenter, SubtitleAlignment, SubtitleBorderStyle, SubtitleStyle, @@ -41,6 +42,7 @@ "SubtitleStyle", "TextStyle", "SceneExtractionType", + "Segmenter", ] diff --git a/videodb/_constants.py b/videodb/_constants.py index e2039b7..447f4a2 100644 --- a/videodb/_constants.py +++ b/videodb/_constants.py @@ -36,6 +36,12 @@ class SemanticSearchDefaultValues: score_threshold = 0.2 +class Segmenter: + time = "time" + word = "word" + sentence = "sentence" + + class ApiPath: collection = "collection" upload = "upload" diff --git a/videodb/video.py b/videodb/video.py index 21a1da4..e006a39 100644 --- a/videodb/video.py +++ b/videodb/video.py @@ -5,6 +5,7 @@ IndexType, SceneExtractionType, SearchType, + Segmenter, SubtitleStyle, Workflows, ) @@ -128,8 +129,8 @@ def _fetch_transcript( self, start: int = None, end: int = None, - segmenter: str = None, - count: int = None, + segmenter: str = Segmenter.word, + length: int = 1, force: bool = None, ) -> None: if ( @@ -137,7 +138,7 @@ def _fetch_transcript( and not start and not end and not segmenter - and not count + and not length and not force ): return @@ -147,7 +148,7 @@ def _fetch_transcript( "start": start, "end": end, "segmenter": segmenter, - "count": count, + "length": length, "force": "true" if force else "false", }, show_progress=True, @@ -159,12 +160,12 @@ def get_transcript( self, start: int = None, end: int = None, - segmenter: str = None, - count: int = None, + segmenter: str = Segmenter.word, + length: int = 1, force: bool = None, ) -> List[Dict]: self._fetch_transcript( - start=start, end=end, segmenter=segmenter, count=count, force=force + start=start, end=end, segmenter=segmenter, length=length, force=force ) return self.transcript @@ -172,12 +173,12 @@ def get_transcript_text( self, start: int = None, end: int = None, - segmenter: str = None, - count: int = None, + segmenter: str = Segmenter.word, + length: int = 1, force: bool = None, ) -> str: self._fetch_transcript( - start=start, end=end, segmenter=segmenter, count=count, force=force + start=start, end=end, segmenter=segmenter, length=length, force=force ) return self.transcript_text