Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Spring cleaning

Updated to Node 0.6.x. Replaced connect with express. Dependencies
changed to latest versions. Updated ffmpeg parsing for 0.10 or higher.
  • Loading branch information...
commit 480bde237c76ba297ad2a808c82062cf44499275 1 parent d533205
@tieleman tieleman authored
View
1  .gitignore
@@ -0,0 +1 @@
+node_modules/
View
6 README.markdown
@@ -14,11 +14,11 @@ Codem-transcode can be used in conjunction with Codem-schedule (https://github.c
## Requirements
-* ffmpeg (compiled/configured to your own taste)
+* ffmpeg (at least 0.10 and compiled/configured to your own taste)
* sqlite3
-* node.js version >= 0.4.x, with packages (if you use npm they will be installed automatically):
+* node.js version 0.6.x, with packages (if you use npm they will be installed automatically):
* sqlite3 (http://github.com/developmentseed/node-sqlite3)
- * connect (http://github.com/senchalabs/Connect)
+ * express (http://expressjs.com/)
* argsparser (http://github.com/kof/node-argsparser)
* mkdirp (https://github.com/substack/node-mkdirp)
View
5 lib/job.js
@@ -181,11 +181,12 @@ Job.prototype.extractDuration = function(text) {
}
Job.prototype.extractProgress = function(text) {
- var re = new RegExp(/time=(\d+).(\d+)/);
+ var re = new RegExp(/time=(\d{2}):(\d{2}):(\d{2})/);
var m = re.exec(text);
if (m != null) {
- var current = parseInt(m[1], 10);
+ var hours = parseInt(m[1], 10), minutes = parseInt(m[2], 10), seconds = parseInt(m[3], 10);
+ var current = hours * 3600 + minutes * 60 + seconds;
this.progress = current / this.duration;
}
}
View
20 lib/server.js
@@ -2,7 +2,7 @@ var config = require('./config').load(),
jobHandler = require('./job-handler'),
fs = require('fs'),
util = require('util'),
- connect = require('connect');
+ express = require('express');
var rejectMessage = 'The transcoder is not accepting jobs right now. Please try again later.';
var acceptedMessage = 'The transcoder accepted your job.';
@@ -10,21 +10,21 @@ var notImplementedMessage = 'This method is not yet implemented.';
var badRequestMessage = 'The data supplied was not valid.';
var notFoundMessage = 'The specified job could not be found.';
-var routes = function(app) {
- app.get( '/jobs', getJobs);
- app.post( '/jobs', postNewJob);
- app.get( '/jobs/:id', getJobStatus);
- app.delete('/jobs/:id', removeJob);
-}
-
var logfile = null;
var server = null;
exports.launch = function() {
logfile = fs.createWriteStream(config['access_log'], { flags: 'a' });
- server = connect.createServer(connect.logger({stream: logfile}));
- server.use(connect.router(routes));
+
+ server = express.createServer(express.logger({stream: logfile}));
+
+ server.get( '/jobs', getJobs);
+ server.post( '/jobs', postNewJob);
+ server.get( '/jobs/:id', getJobStatus);
+ server.delete('/jobs/:id', removeJob);
+
server.listen(config['port'], config['interface']);
+
util.log("Started server on interface " + config['interface'] + " port " + config['port'] + " with pid " + process.pid + ".");
}
View
15 package.json
@@ -1,21 +1,22 @@
{
"name": "codem-transcode",
"description": "Offline video transcoding using ffmpeg, with a small HTTP API.",
- "version": "0.2.2",
+ "version": "0.3.0",
+ "keywords": ["transcoding", "ffmpeg", "video"],
"homepage": "http://www.transcodem.com/",
"repository": {
"type": "git",
"url": "https://github.com/madebyhiro/codem-transcode.git"
},
- "bin": "./bin/codem-transcode",
+ "bin": { "codem-transcode": "./bin/codem-transcode" },
"engines": {
- "node": ">= 0.4"
+ "node": "~0.6.13"
},
"dependencies": {
- "sqlite3": ">= 2.0.12",
- "mkdirp": ">= 0.0.2",
- "connect": ">= 1.4.1",
- "argsparser": ">= 0.0.5"
+ "sqlite3": "~2.1.1",
+ "mkdirp": "~0.3.0",
+ "express": "~2.5.8",
+ "argsparser": "~0.0.6"
},
"licenses": [{
"type": "MIT",
Please sign in to comment.
Something went wrong with that request. Please try again.