Overview

LogOpen creates a new log file.

LogClose closes and flushes the specified log file.

LogString appends a message to the specified log file.

SetCacheHints sets the cache hints to the input clip.

ScanClip requests each frame in order from the input clip.

CompareFiles compares the contents of the two specified files.

Syntax

LogOpen(string filename, bool "append")
LogClose(string filename)
LogString(string filename, string message)

SetCacheHints(clip c, int hintsType, int radius)

ScanClip(clip c)

CompareFiles(string filename1, string filename2, bool "binary")

LogOpen

Syntax

LogOpen(string filename, bool "append")

Parameters

filename The desired name of the log file.
"append" Pass true to append to an existing file.
Pass false to overwrite it.
(Default: false)

LogClose

Syntax

LogClose(string filename)

Parameters

filename The name of the log file to close.

LogString

Syntax

LogString(string filename, string message)

Parameters

filename The name of the log file.
message The message to write.

Usage

Creates the specified log file if it doesn't exist already.

SetCacheHints

Syntax

SetCacheHints(clip c, int hintsType, int radius)

Parameters

hintsType Specifies what to cache. Must be one of the following values:
  • 0: CACHE_NOTHING
  • 1: CACHE_RANGE
  • 2: CACHE_ALL
  • 3: CACHE_AUDIO
  • 4: CACHE_AUDIO_NONE
(I really don't understand what each of these values means. Sorry.)
radius The radius of frames to cache. Or something. Beats me.

Usage

This function allows a script to set the cache hints to a clip directly.

This function is a mutator; it modifies an existing clip directly. It does not return a new clip.

ScanClip

Syntax

ScanClip(clip c)

Usage

Requests all frames from a clip upon script load. Useful when used in conjunction with WriteFile.

For example, the following script outputs a log file that lists the frame numbers selected via SelectEvery and compares the results to expected values:

BlankClip(length=100)
WriteFile(GetWorkingDir() + "frames.log", "current_frame", append=false)

# Disable caching to WriteFile.  If caching is not disabled here, if a
# frame is requested multiple times, only the first request will output
# to the log file.
SetCacheHints(0, 0)

SelectEvery(5, 0, 0, 1, 2)

ScanClip()

# check that the output frame numbers match the expected values
Assert(CompareFiles("frames.log", "expectedFrames.log"),
\      "Frame numbers don't match expected values")

CompareFiles

Syntax

CompareFiles(string filename1, string filename2, bool "binary")

Parameters

filename1
filename2
The names of the two files to compare.
"binary" Pass true to perform a binary comparison of the two files.
Pass false to perform a textual comparison.
(Default: true)

Usage

Returns true if the two files have identical contents, false otherwise.

Revision History