MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / TimecodeValue

Class TimecodeValue

scenedetect/_cli/config.py:75–96  ·  view source on GitHub ↗

Validator for timecode values in seconds (100.0), frames (100), or HH:MM:SS. Stores value in original representation.

Source from the content-addressed store, hash-verified

73
74
75class TimecodeValue(ValidatedValue):
76 """Validator for timecode values in seconds (100.0), frames (100), or HH:MM:SS.
77
78 Stores value in original representation."""
79
80 def __init__(self, value: int | float | str):
81 # Ensure value is a valid timecode.
82 FrameTimecode(timecode=value, fps=100.0)
83 self._value = value
84
85 @property
86 def value(self) -> int | float | str:
87 return self._value
88
89 @staticmethod
90 def from_config(config_value: str, default: "TimecodeValue") -> "TimecodeValue":
91 try:
92 return TimecodeValue(config_value)
93 except ValueError as ex:
94 raise OptionParseFailure(
95 "Timecodes must be in seconds (100.0), frames (100), or HH:MM:SS."
96 ) from ex
97
98
99class RangeValue(ValidatedValue):

Callers 2

from_configMethod · 0.85
config.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected