diff --git a/.bzrignore b/.bzrignore deleted file mode 100644 index e5e800b7..00000000 --- a/.bzrignore +++ /dev/null @@ -1,8 +0,0 @@ -.DS_Store -tools/geo/json/_cities.json -dev -build/ -min/ -tools/geo/json/countries.json -index.json -._* diff --git a/source/Ox/js/String.js b/source/Ox/js/String.js index b395c252..17f3a437 100644 --- a/source/Ox/js/String.js +++ b/source/Ox/js/String.js @@ -207,9 +207,13 @@ Ox.parseSRT Parses an srt subtitle file [{'in': 3720, out: 3723.4, text: 'Hello World'}] @*/ Ox.parseSRT = function(string, fps) { - return string.replace(/\r\n/g, '\n').replace(/\n+$/, '').split('\n\n') + return string.replace(/\r\n/g, '\n').trim().split('\n\n') .map(function(block) { var lines = block.split('\n'), points; + if (lines.length < 3) { + Ox.Log('Core', 'skip invalid srt block', lines); + continue; + } lines.shift(); points = lines.shift().split(' --> ').map(function(point) { return point.replace(',', ':').split(':')