Facility Control

 View Only
  • 1.  Display file location and duration

    Posted 07-02-2019 15:52
    We would like to browse the harddrive for video files and create a list of about 10 files with its location and duration within dashboard.
    Then we need to add all durations together to create a countdown of the whole list.
     
    The file locations would be a datalinq for XPression. With a button we would like to start the countdown and play the list in XPression. Would you be able to help?

     



  • 2.  RE: Display file location and duration

    Posted 07-03-2019 20:23

    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