Skip to main content
Participant
January 17, 2013
Question

Script to export info from video field?

  • January 17, 2013
  • 1 reply
  • 939 views

Hi all,

I have been looking for a script to run and export metadata from the video field (e.g res, shot name, file name, tape name, take etc) but cannot find anything. Can someone please help? We want to export a CSV, spreadsheet etc of all our material so we can archive it... I would be very grateful if someone could help us out!

Thanks

Costa

This topic has been closed for replies.

1 reply

Paul Riggott
Inspiring
January 17, 2013

Would this do?

Just select the documents and run the script from the Tools menu.

The CSV file will be created on the desktop.

#target bridge  

if( BridgeTalk.appName == "bridge" ) { 

var videoInfo = new MenuElement( "command", "Video Info to CSV", "at the end of Tools" , "vidinf" );

}

videoInfo.onSelect = function () {

var sels = app.document.selections;

if(sels.length <1) return;

var TimeNow = new Date();

var hours = TimeNow.getHours();

var minutes = TimeNow.getMinutes();

var seconds = TimeNow.getSeconds();

if (hours > 12) hours = hours - 12;

if (hours == 0) hours = 12;

if (minutes <= 9) minutes = "0" + minutes;

if (seconds <= 9) seconds = "0" + seconds;

var TodaysTime = "_" + hours + "-" + minutes + "-"+seconds;

var outCSV = File(Folder.desktop + "/" +decodeURI(Folder(app.document.presentationPath).name)  +TodaysTime.toString() + ".csv");

outCSV.open('w');

outCSV.writeln("FileName,Tape Name,Alternative Tape Name,Scene/Take,Date,Comment");

for(var a in sels){

var md = sels.synchronousMetadata;

var name = decodeURI(sels.spec.name);

var tapeName = ("'" +md.read("http://ns.adobe.com/xmp/1.0/DynamicMedia/","xmpDM:tapeName")).toString().replace(/^'/,'');

var altTapeName = ("'" +md.read("http://ns.adobe.com/xmp/1.0/DynamicMedia/","xmpDM:altTapeName")).toString().replace(/^'/,'');

var scene = ("'" +md.read("http://ns.adobe.com/xmp/1.0/DynamicMedia/","xmpDM:scene")).toString().replace(/^'/,'');

var logComment = ("'" +md.read("http://ns.adobe.com/xmp/1.0/DynamicMedia/","xmpDM:logComment")).toString().replace(/^'/,'');

var shotTake = ("'" +md.read("http://ns.adobe.com/xmp/1.0/DynamicMedia/","xmpDM:shotName")).toString().replace(/^'/,'');

var shotDate = ("'" +md.read("http://ns.adobe.com/xmp/1.0/DynamicMedia/","xmpDM:shotDate")).toString().replace(/^'/,'');

outCSV.writeln(name + "," + tapeName +"," + altTapeName +","+scene+","+shotTake+","+shotDate+","+logComment);

    }

outCSV.close();

}

Laser LTDAuthor
Participant
January 17, 2013

Thanks Paul!

I am having issues seeing it in Bridge though... I am not very script literate and I do not know how to get the script to show in Bridge. I have put the script into the correct folder, but I can't see it anywhere in Bridge! I just opened another script I had and replaced the text with yours, but nothing is happening:(

EDIT - Ah NM, I renamed the file and it is now working! Thanks again! Do you know of any good CSV viewers? I am opening the file up in a open office spreadsheet and its not creating proper formatting for the columns!

Costa

Paul Riggott
Inspiring
January 17, 2013

Excel should be fine. I wonder if some of your fields contain carriage return or linefeeds, if so could you let me know what fields they are.