Hi Vincent.
Getting the a list of files in a directory is fairly straight forward in ogScript. Getting the duration of video clips on your hard drive is not since it requires some ability to open/parse the file format.
For your first part, calling ogscript.post('path_to_directory', null, null); will return a list of all files in a directory separated by newlines.
For your second part, I wonder if your whole problem is better-handled with DashBoard's VDCP library - it allows you to query a clip server for a list of its clips and provides mechanisms to get the duration of each clip once you have its ID.
For this route, you'll want to use vdcp.listClips('host', port, channel, callbackFunction); and vdcp.clipDuration('host', port, channel, 'clip_id', callbackFunction);
Your callback function in both cases would have the signature:
(success_flag, data_sent, result, exception_if_success_is_false)
for example:
function callbackFunction(success, cmd, result, exception)
{
if (success)
{
for (var i = 0; i < result.length; i++)
{
ogscript.debug("GOT BACK " + result[i]);
//LOOKUP DURATION HERE
}
}
}
vdcp.listClips('HOST_NAME_OR_IP', PORT_FOR_VDCP, callbackFunction);
#DashBoard