Skip to content

Commit aac5d34

Browse files
author
Philipp Matthias Hahn
committed
Add documentation and type annotations
1 parent 14ba111 commit aac5d34

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

vidcutter/libs/videoservice.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,13 @@ def probe(self, source: str) -> Munch:
610610
raise
611611

612612
def getKeyframes(self, source: str, formatted_time: bool = False) -> List[Union[str, float]]:
613+
"""
614+
Return a list of key-frame times.
615+
616+
:param source: The file name of the media file.
617+
:param formatted_time: If `True`, return times list of strings. Defaults to `False`, which returns times as list of floats.
618+
:returns: a list of key-frame times, eiter formatted as strings or floats.
619+
"""
613620
if len(self.keyframes) and source == self.source:
614621
return self.keyframes
615622
timecode = '0:00:00.000000' if formatted_time else 0
@@ -639,6 +646,14 @@ def getKeyframes(self, source: str, formatted_time: bool = False) -> List[Union[
639646
return keyframe_times
640647

641648
def getGOPbisections(self, source: str, start: float, end: float) -> Dict[str, Tuple[float, float, float]]:
649+
"""
650+
Return a mapping of the start and end time to the 3 surronging key-frames.
651+
652+
:param source: The file name of the media file.
653+
:param start: The start time.
654+
:param end: The end time.
655+
:returns: A dictionary mapping `start` and `end` to 3-tuples (before, exact, after).
656+
"""
642657
keyframes = self.getKeyframes(source)
643658
start_pos = bisect_left(keyframes, start)
644659
end_pos = bisect_left(keyframes, end)

0 commit comments

Comments
 (0)