Validator for timecode values in seconds (100.0), frames (100), or HH:MM:SS. Stores value in original representation.
| 73 | |
| 74 | |
| 75 | class 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 | |
| 99 | class RangeValue(ValidatedValue): |
no outgoing calls
no test coverage detected