codem-transcode
Advanced tools
Comparing version 0.5.10 to 0.5.11
@@ -22,7 +22,7 @@ var util = require('util'), | ||
sql: null, | ||
generateThumbnailPath: function(destinationFile, offset, format) { | ||
return [path.dirname(destinationFile), path.basename(destinationFile, path.extname(destinationFile))].join(path.sep) + "-" + offset + "." + format; | ||
return [path.dirname(destinationFile), path.basename(destinationFile, path.extname(destinationFile))].join(path.sep) + "-" + offset + "." + format; | ||
}, | ||
generateRangeFromThumbOpts: function(thumbOpts, duration) { | ||
@@ -39,3 +39,3 @@ if (thumbOpts['percentages']) { | ||
}, | ||
getDatabase: function() { | ||
@@ -55,2 +55,3 @@ if (JobUtils.sql == null) { | ||
port: config['database']['port'], | ||
omitNull: true, | ||
pool: false, | ||
@@ -80,3 +81,3 @@ logging: false | ||
}, | ||
migrateDatabase: function(callback) { | ||
@@ -90,3 +91,3 @@ var migrator = JobUtils.getDatabase().getMigrator({path: __dirname + "/../migrations" }); | ||
}, | ||
pad: function(orig, padString, length) { | ||
@@ -98,3 +99,3 @@ var str = orig; | ||
}, | ||
percentagesToRange: function(percentages, duration) { | ||
@@ -113,3 +114,3 @@ if (Array.isArray(percentages)) { | ||
}, | ||
secondsToRange: function(seconds, duration) { | ||
@@ -128,3 +129,3 @@ if (Array.isArray(seconds)) { | ||
}, | ||
verifyDatabase: function(callback) { | ||
@@ -231,8 +232,8 @@ JobUtils.getDatabase().getQueryInterface().showAllTables().success(function (tables) { | ||
if (err) { | ||
job.exitHandler(-1, "unable to create output directory (" + destination_dir + ")."); | ||
job.exitHandler(-1, "unable to create output directory (" + destination_dir + ")."); | ||
} else { | ||
if (stats.isDirectory()) { | ||
callback("hasOutputDir"); | ||
callback("hasOutputDir"); | ||
} else { | ||
job.exitHandler(-1, "unable to create output directory (" + destination_dir + ")."); | ||
job.exitHandler(-1, "unable to create output directory (" + destination_dir + ")."); | ||
} | ||
@@ -277,5 +278,5 @@ } | ||
} | ||
var the_process = child_process.spawn(config['encoder'], args); | ||
var the_process = child_process.spawn(config['encoder'], args); | ||
the_process.stderr.on('data', function(data) { job.progressHandler(data); }); | ||
@@ -329,3 +330,3 @@ the_process.on('error', function(err) { job.lastMessage = 'Unable to execute the ffmpeg binary: ' + err; job.didFinish(1); }); | ||
var inputFile = (this.parsedOpts()['encoder_options'].length > 0) ? job.tmpFile : this.parsedOpts()['source_file'] | ||
args.push('-i', inputFile, | ||
@@ -400,3 +401,3 @@ '-codec', 'copy', '-map', '0', '-f', 'segment', | ||
var args = ['-ss', offset, '-i', job.parsedOpts()['source_file'], '-vframes', '1', '-y']; | ||
// Explicit size provided | ||
@@ -409,7 +410,7 @@ if (thumbOpts['size'] && thumbOpts['size'] != 'src') { | ||
var destinationFile = job.parsedOpts()['destination_file']; | ||
// Destination file + offset + extension | ||
var outputFile = JobUtils.generateThumbnailPath(destinationFile, offset, format); | ||
args.push(outputFile); | ||
var thumb_process = child_process.execFile(config['encoder'], args, { maxBuffer: 4096*1024 }, function(error, stdout, stderr) { | ||
@@ -490,3 +491,3 @@ if (error) { | ||
if (this.hasExited) return; | ||
this.lastMessage = data.toString().replace("\n",''); | ||
@@ -500,3 +501,3 @@ | ||
// error while saving job | ||
}); | ||
}); | ||
}, | ||
@@ -515,7 +516,7 @@ extractDuration: function(text) { | ||
notifyHandler.notify(this); | ||
} | ||
} | ||
}, | ||
extractProgress: function(text) { | ||
// 00:00:00 (hours, minutes, seconds) | ||
var re = new RegExp(/time=(\d{2}):(\d{2}):(\d{2})/); | ||
var re = new RegExp(/time=(\d{2}):(\d{2}):(\d{2})/); | ||
var m = re.exec(text); | ||
@@ -529,3 +530,3 @@ | ||
// 00.00 (seconds, hundreds) | ||
re = new RegExp(/time=(\d+).(\d{2})/); | ||
re = new RegExp(/time=(\d+).(\d{2})/); | ||
m = re.exec(text); | ||
@@ -532,0 +533,0 @@ |
var url = require('url'), | ||
http = require('http'), | ||
https = require('https'), | ||
logger = require('./logger'); | ||
@@ -26,3 +27,4 @@ | ||
}; | ||
var req = http.request(urlOpts, function(res) { | ||
var requestHandler = obj.protocol == "https:" ? https : http; | ||
var req = requestHandler.request(urlOpts, function(res) { | ||
logger.log('Notification completed with HTTP status code: ' + res.statusCode); | ||
@@ -29,0 +31,0 @@ }).on('error', function(err) { |
{ | ||
"name": "codem-transcode", | ||
"description": "Offline video transcoding using ffmpeg, with a small HTTP API.", | ||
"version": "0.5.10", | ||
"version": "0.5.11", | ||
"keywords": ["transcoding", "ffmpeg", "video"], | ||
@@ -6,0 +6,0 @@ "homepage": "http://www.transcodem.com/", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64119
1095
5