Format to display timecodes.
| 308 | |
| 309 | |
| 310 | class TimecodeFormat(Enum): |
| 311 | """Format to display timecodes.""" |
| 312 | |
| 313 | FRAMES = 0 |
| 314 | """Print timecodes as exact frame number.""" |
| 315 | TIMECODE = 1 |
| 316 | """Print timecodes in format HH:MM:SS.nnn.""" |
| 317 | SECONDS = 2 |
| 318 | """Print timecodes in seconds SSS.sss.""" |
| 319 | |
| 320 | def format(self, timecode: FrameTimecode) -> str: |
| 321 | if self == TimecodeFormat.FRAMES: |
| 322 | return str(timecode.frame_num) |
| 323 | if self == TimecodeFormat.TIMECODE: |
| 324 | return timecode.get_timecode() |
| 325 | if self == TimecodeFormat.SECONDS: |
| 326 | return f"{timecode.seconds:.3f}" |
| 327 | raise RuntimeError("Unhandled format specifier.") |
| 328 | |
| 329 | |
| 330 | class FcpFormat(Enum): |
nothing calls this directly
no outgoing calls
no test coverage detected