Counting Modes

class timecode.modes.CountingMode

Bases: ABC

An abstract class to facilitate timecode frame counting modes

SEPARATOR = ':'

The character expected and used for separation of elements

ALLOW_NEGATIVE_TIMECODE = True

Allow negative timecodes with this mode

DEFAULT_RATE = 24

The default frame rate to use if not provided

classmethod validate_rate(rate: int | None = None) int

Validate and clean the user-provided rate

classmethod hours(framenumber: int, rate: int) int

Hours element

classmethod minutes(framenumber: int, rate: int) int

Minutes element

classmethod seconds(framenumber: int, rate: int) int

Seconds element

classmethod frames(framenumber: int, rate: int) int

Frames element

class timecode.modes.NonDropFrame

Bases: CountingMode

Non-drop-frame timecode mode

DEFAULT_RATE = 24

The default frame rate to use if not provided

SEPARATOR = ':'

The character expected and used for separation of elements

class timecode.modes.DropFrame

Bases: CountingMode

Drop-frame timecode mode

DEFAULT_RATE = 30

DF timecodes are intended for multiples of 30

SEPARATOR = ';'

The character expected and used for separation of elements

classmethod validate_rate(rate: int | None = None) int

Validate and clean the user-provided rate

classmethod get_dropped_frames(framenumber: int, rate: int) int

Calculate the number of frames to drop

classmethod hours(framenumber: int, rate: int) int

Hours element

classmethod minutes(framenumber: int, rate: int) int

Minutes element

classmethod seconds(framenumber: int, rate: int) int

Seconds element

classmethod frames(framenumber: int, rate: int) int

Frames element