Permalink
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...
1 parent d533205 commit 480bde237c76ba297ad2a808c82062cf44499275 @tieleman tieleman committed Mar 20, 2012
Showing with 25 additions and 22 deletions.
  1. +1 −0 .gitignore
  2. +3 −3 README.markdown
  3. +3 −2 lib/job.js
  4. +10 −10 lib/server.js
  5. +8 −7 package.json
View
@@ -0,0 +1 @@
+node_modules/
View
@@ -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
@@ -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
@@ -2,29 +2,29 @@ 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.';
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
@@ -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",

0 comments on commit 480bde2

Please sign in to comment.