ftrack_connect.duration

class ftrack_connect.duration.DurationParser[source]

Parse human readable time durations into seconds.

__init__()[source]

Initialise parser.

parse(text)[source]

Return text parsed into seconds as float.

Supported formats are:

  • unit-less integer - Interpreted as minutes. Example: “90” is 1 hour and 30 minutes.
  • unit-less float - Interpreted as hours. Example: “1.5” is 1 hour and 30 minutes.
  • hh:mm - Specify hours and minutes. Can use padded or unpadded digits. Example: “03:42” is 3 hours and 42 minutes.
  • mm:ss min - Specify minutes and seconds. Can use padded or unpadded digits. Example: “03:42 min” is 3 minutes and 42 seconds.
  • hh:mm:ss - Specify hours, minutes and seconds. Can use padded or unpadded digits. Example: “8:45:03” is 8 hours, 43 minutes and 3 seconds.
  • {hours unit} {minutes unit} {seconds unit} - Can enter specific values for each optional unit. Valid unit specifiers include both full words and abbreviations. Example: “1h 2 minutes 5 sec” It is also possible to use fractions. Example: “1.5h 15seconds”

Raise ParseError if text could not be parsed.

class ftrack_connect.duration.DurationFormatter[source]

Format durations in seconds into human readable strings.

format(seconds)[source]

Return human readable string representing seconds duration.