Javascript EDL reader
-
For a Project I'm working on, I needed to transfer subtitle cues from Adobe Premiere sequences to Isadora.
As Premiere can export an EDL edit list with timecode for IN and OUT marks, based on @DusX 'select line of text' script, I did an EDL reader.In combination with @Woland 's updated version of @fifou 's Timecode trigger actor, I managed to rebuild Premiere cut sequences in no time.
Maybe someone else can use it, so here are the script and a user actor with the named In / Outs:
(This is only tested with Premieres EDL export, with option 'Use Source Filename' on! But should work with other softwares EDL files like FinalCut too.)======================
function main()
{
// reads EDL files and filters values to output them them for further use including ClipTitle/ Clip Filename if put to a Note under the basic values// 2 Inputs: 1:File name or path (TEXT); 2:Line to select (INTEGER)
// 10 Outputs: 1:Cues/Cuts total (INTEGER); 2:Cue/Cut # (INTEGER); 3:Media Type (TEXT); 4:Stream Type (TEXT); 5:Transition Type (TEXT); 6:Duration in Seconds (INTEGER); 7:SourceIN (TEXT); 8:SourceOUT (TEXT); 9:RecIN (TEXT); 10:RecOUT (TEXT); 11:Media Title (TEXT)
// arguments[0] = text file name or path
// arguments[1] = line to select
// read EDL file
var txt = read (arguments[0]);// split cue lines to an array and count cues
var Cues = txt.split("\r\n\r\n");
var CuesCount = Cues.length;// split cue values from notes
var ValuesNotes = Cues[arguments[1]].split("\r\n");
var NotesCount = ValuesNotes.length - 1;// split values to an array and count the values
var Values = ValuesNotes[0].split(" ");
var ValuesCount = Values.length;// read the values from the values array
var CueNumber = Values[0];var ValueTyp = Values[2];
var ValueStream = Values[9];
var ValueTrans = Values[14];
var ValueDur = Values[5];
var ValueSourceIN = Values[22];
var ValueSourceOUT = Values[23];
var ValueRecIN = Values[24];
var ValueRecOUT = Values[25];// read the Cue/file name if there is one
if (NotesCount > 0) {
var ClipTitleNote = ValuesNotes[1].split(": ");
var ClipTitle = ClipTitleNote[1];
} else {
var ClipTitleNote = "Undefined";
var ClipTitle = ClipTitleNote;
}// outputs
return [ CuesCount - 1, CueNumber, ValueTyp, ValueStream, ValueTrans, ValueDur, ValueSourceIN, ValueSourceOUT, ValueRecIN, ValueRecOUT, ClipTitle ];}
P.S.: Maybe someone have an idea how to change the script, so it jumps to the Cue# directly and reads the values instead of reading each line separately. (maybe with .StartWith() ?) -
I love seeing material come together from multiple users to create new and interesting tools. Great work!
Best wishes,
Woland