OptrisOptrisDocumentation

Documentation/OTC SDK/Overviewv12.0

File name patterns

Every path where the SDK names a file for you -- interval capture, a rule's SnapshotAction, a rule's RecordingAction -- takes a pattern and expands the same placeholders the same way.

Token Expands to
{sequence} Counter, zero-padded to six digits. Interval capture counts from 1; an alarm action uses the event's sequence.
{timestamp} The wall clock as the file is written, YYYYmmdd_HHMMSS in local time.
{timestamp_us} For an alarm action, AlarmEvent::timestamp_us verbatim. Empty for interval capture.
{serial} The camera's serial, e.g. 24120005.
{model} The camera's model, e.g. Xi 400.
{rule} The alarm rule's name, or its decimal id when unnamed. Empty for interval capture.
{region} The region the rule watched, same fallback. Empty for a non-region rule and for interval capture.

A token with nothing behind it expands to the empty string, not to itself: {rule} in a time-lapse name would otherwise put the word {rule} in every file.

Every expansion, and the finished stem, is made safe to use as a file name: path separators, :*?"<>| and control characters become _, and spaces become _. A rule named ../../etc/passwd cannot walk out of the output directory.

A name that already exists is never overwritten. The SDK appends -1, -2, ... up to -9999 instead.

What changed in v12: What changed in v12 There used to be two expanders with one vocabulary and two meanings, so an application with a single file-name setting feeding both -- which is the normal shape -- could not promise its user any format at all. They are now one. Two of the alarm path's behaviours changed to get there: - {timestamp} was AlarmEvent::timestamp_us, a raw microsecond integer. That field carries the frame's capture stamp, which on the Linux USB transports is steady_clock -- microseconds since the host booted. It is not a date, cannot be formatted as one, and does not compare across runs. It is still reachable, unchanged, as {timestamp_us}. - {sequence} was unpadded, which is the only thing that stopped a directory listing sorting in capture order.

Interval capture gained {serial}, {model}, {rule}, {region} and {timestamp_us}, and stopped overwriting an existing file.