Created
February 3, 2012 05:35
-
-
Save anonymous/1728346 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _screenShotInternal(callback) { | |
// get correct dimensions | |
self._prepare(function(err, meta) { | |
if (meta.durationsec) { | |
// check if all timemarks are inside duration | |
if (timemarks !== null) { | |
for (var i = 0; i < timemarks.length; i++) { | |
if (parseInt(timemarks[i]) > (meta.durationsec * 0.9)) { | |
// remove timemark from array | |
timemarks.splice(i, 1); | |
} | |
} | |
// if there are no more timemarks around, add one at end of the file | |
if (timemarks.length == 0) { | |
timemarks[0] = (meta.durationsec * 0.9); | |
} | |
} | |
// get positions for screenshots (using duration of file minus 10% to remove fade-in/fade-out) | |
var secondOffset = (meta.durationsec * 0.9) / screenshotcount; | |
var donecount = 0; | |
var series = []; | |
var i = 1; | |
// use async helper function to generate all screenshots and | |
// fire callback just once after work is done | |
async.until( | |
function() { | |
return i > screenshotcount; | |
}, | |
function(taskcallback) { | |
var offset; | |
if (timemarks !== null) { | |
// get timemark for current iteration | |
offset = timemarks[(i - 1)]; | |
} else { | |
offset = secondOffset * i; | |
} | |
var target = Meta.escapedPath(folder + '/tn_' + offset + 's.jpg'); | |
var input = Meta.escapedPath(self.options.inputfile); //<============ changed from this.options.inputfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment