From 083051dfc5dbb5d91e2d054b914cbc97e11417a7 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 28 Aug 2012 13:11:28 +0200 Subject: [PATCH] dont overlap layers if in[i]==out[i+1] during srt import --- static/js/pandora/importAnnotations.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/static/js/pandora/importAnnotations.js b/static/js/pandora/importAnnotations.js index 37ba0196e..5d311bd6e 100644 --- a/static/js/pandora/importAnnotations.js +++ b/static/js/pandora/importAnnotations.js @@ -89,6 +89,20 @@ pandora.ui.importAnnotations = function(data) { ); } } + function parseSRT(data) { + var srt = Ox.parseSRT(data), + length = srt.length - 1; + //pandora layers include outpoint, + //speedtrans right now sets in to out, + //to avoid one frame overlaps, + //move outpoint by 0.001 seconds + for (var i=0; i < length; i++) { + if (srt[i].out == srt[i+1]['in']) { + srt[i].out = srt[i].out - 0.001; + } + } + return srt; + } content.append($('
').css({ padding: '4px', paddingBottom: '16px' @@ -118,7 +132,7 @@ pandora.ui.importAnnotations = function(data) { file = this.files[0]; var reader = new FileReader(); reader.onloadend = function(event) { - srt = Ox.parseSRT(this.result); + srt = parseSRT(this.result); total = srt.length; total && importButton.options({disabled: false}); $status.html(