aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Benden2014-12-15 19:08:49 (GMT)
committerJoseph Benden2014-12-15 19:08:49 (GMT)
commit28c8cf08ec690a841911692958ea3223e0fb416a (patch)
treebd8c0ab48e24ed5d04fcb7ebb928cec74d5dbb03
parent597f525676ee09c5cc33d7f1c9c65f8be0b0543a (diff)
downloadHLS-Streamer-JS-28c8cf08ec690a841911692958ea3223e0fb416a.zip
HLS-Streamer-JS-28c8cf08ec690a841911692958ea3223e0fb416a.tar.gz
HLS-Streamer-JS-28c8cf08ec690a841911692958ea3223e0fb416a.tar.bz2
HLS-Streamer-JS-28c8cf08ec690a841911692958ea3223e0fb416a.tar.xz
Abstracted configuration into file. Removed extra debugging lines. Fixed devserver launch bug. Updated README file.
-rw-r--r--README.md10
-rw-r--r--apps/sidewalk/routes.coffee8
-rw-r--r--config.js1
-rw-r--r--models/video.coffee3
-rw-r--r--package.json2
-rw-r--r--server.js80
6 files changed, 48 insertions, 56 deletions
diff --git a/README.md b/README.md
index d5804d8..a94d380 100644
--- a/README.md
+++ b/README.md
@@ -23,9 +23,11 @@ The available directories are configured inside of `apps/sidewalk/routes.coffee`
236. Feel free to modify this line to suite your multimedia collection. This should be 236. Feel free to modify this line to suite your multimedia collection. This should be
24abstracted out to a configuration file, it just hasn't happened yet. 24abstracted out to a configuration file, it just hasn't happened yet.
25 25
26To-Do 26FFMpeg Installation
27----- 27-------------------
28 28
29* Abstract available paths to a configuration file. 29Using [Homebrew](http://brew.sh) for installation of FFMpeg is easy. Simply copy
30* Include a line to build an optimized FFMpeg from Homebrew. 30and paste the following line in to *Terminal*.
31
32 # brew install ffmpeg --HEAD --with-x264 --with-faac --with-lame --with-xvid
31 33
diff --git a/apps/sidewalk/routes.coffee b/apps/sidewalk/routes.coffee
index 30610a3..0c47baf 100644
--- a/apps/sidewalk/routes.coffee
+++ b/apps/sidewalk/routes.coffee
@@ -2,8 +2,14 @@ Video = require '../../models/video'
2fs = require 'fs' 2fs = require 'fs'
3fp = require 'filepath' 3fp = require 'filepath'
4Transcoder = require '../../models/transcoder' 4Transcoder = require '../../models/transcoder'
5paths = require '../../config'
6p = require 'path'
5 7
6default_paths = [new Video(path:'/Volumes', name:'Storage', directory:true), new Video(path:'/Volumes', name:'Desktop', directory:true)] 8default_paths = []
9for path in paths
10 item_path = p.dirname(path)
11 item_name = p.basename(path)
12 default_paths.push(new Video(path: item_path, name: item_name, directory: true))
7 13
8routes = (app) -> 14routes = (app) ->
9 app.get '/', (req, res) -> 15 app.get '/', (req, res) ->
diff --git a/config.js b/config.js
new file mode 100644
index 0000000..b20358d
--- /dev/null
+++ b/config.js
@@ -0,0 +1 @@
module.exports = ['/Volumes/Desktop','/Volumes/Storage','/Volumes/Users MacPro Srv']
diff --git a/models/video.coffee b/models/video.coffee
index 4a1ebc5..b68ed89 100644
--- a/models/video.coffee
+++ b/models/video.coffee
@@ -41,7 +41,6 @@ class Video
41 st = fs.statSync(path + "/" + file) 41 st = fs.statSync(path + "/" + file)
42 s = st.size.toString().commafy() 42 s = st.size.toString().commafy()
43 video = new Video({name: file, path: path, directory: st.isDirectory(), size: s, play_count: 0, paused_at: 0, total_views: 0}) 43 video = new Video({name: file, path: path, directory: st.isDirectory(), size: s, play_count: 0, paused_at: 0, total_views: 0})
44 console.log(video)
45 videos.push video 44 videos.push video
46 callback null, videos 45 callback null, videos
47 @ 46 @
@@ -69,4 +68,4 @@ class Video
69 redis.hdel Video.key(), @id, (err) -> 68 redis.hdel Video.key(), @id, (err) ->
70 callback err if callback 69 callback err if callback
71 70
72module.exports = Video \ No newline at end of file 71module.exports = Video
diff --git a/package.json b/package.json
index b7cad5b..ab926eb 100644
--- a/package.json
+++ b/package.json
@@ -32,6 +32,6 @@
32 "scripts": { 32 "scripts": {
33 "test": "./bin/test", 33 "test": "./bin/test",
34 "watch": "./bin/test --growl --watch", 34 "watch": "./bin/test --growl --watch",
35 "devserver": "./node_modules/node-dev/node-dev server.js" 35 "devserver": "./node_modules/node-dev/bin/node-dev server.js"
36 } 36 }
37} 37}
diff --git a/server.js b/server.js
index 80d9517..e559eef 100644
--- a/server.js
+++ b/server.js
@@ -4,70 +4,52 @@ var CoffeeScript = require('coffee-script');
4 * Module dependencies. 4 * Module dependencies.
5 */ 5 */
6 6
7var express = require('express'), 7var express = require('express'),
8 stylus = require('stylus'); 8 stylus = require('stylus'),
9var busboy = require('express-busboy'); 9 busboy = require('express-busboy'),
10var cookieParser = require('cookie-parser'); 10 cookieParser = require('cookie-parser'),
11var session = require('express-session'); 11 session = require('express-session');
12 12
13require('express-namespace') 13require('express-namespace')
14 14
15var app = module.exports = express(); 15var app = module.exports = express();
16
16CoffeeScript.register(); 17CoffeeScript.register();
18
17var server = require('http').Server(app); 19var server = require('http').Server(app);
18require('./apps/socket-io')(server) 20require('./apps/socket-io')(server)
19 21
20// Configuration 22// Configuration
21//app.configure(function () { 23app.use(stylus.middleware({
22 app.use(stylus.middleware({ 24 src: __dirname + "/views",
23 src: __dirname + "/views", 25 // It will add /stylesheets to this path.
24 // It will add /stylesheets to this path. 26 dest: __dirname + "/public"
25 dest: __dirname + "/public" 27}));
26 })); 28app.set('views', __dirname + '/views');
27 app.set('views', __dirname + '/views'); 29app.set('view engine', 'jade');
28 app.set('view engine', 'jade'); 30app.engine('jade', require('jade').__express);
29 app.engine('jade', require('jade').__express); 31app.set('view options', { layout: false });
30 app.set('view options', { layout: false }); 32app.set('port', 3001);
31 app.set('port', 3001); 33busboy.extend(app);
32 // app.use(busboy({immediate:true})); 34app.use(cookieParser());
33 busboy.extend(app); 35app.use(session({
34 //app.use(express.methodOverride()); 36 secret: "KioxIqpvdyfMXOHjVkUQmGLwEAtB0SZ9cTuNgaWFJYsbzerCDn"
35 app.use(cookieParser()); 37}));
36 app.use(session({ 38app.use(require('connect-assets')());
37 secret: "KioxIqpvdyfMXOHjVkUQmGLwEAtB0SZ9cTuNgaWFJYsbzerCDn" 39app.use(express.static(__dirname + '/public'));
38 })); 40
39 app.use(require('connect-assets')()); 41if ('development' == app.get('env')) {
40 // app.use(app.router);
41 app.use(express.static(__dirname + '/public'));
42//});
43
44 /*
45 app.use(function(req, res, next) {
46 req.busboy.on('field', function(fieldname, val) {
47 req.body[fieldname] = val;
48 });
49 req.busboy.on('finish', function() {
50 next();
51 });
52 });
53 */
54
55//app.configure('development', function () {
56 //app.use(express.errorHandler({ 42 //app.use(express.errorHandler({
57 // dumpExceptions: true, 43 // dumpExceptions: true,
58 // showStack: true 44 // showStack: true
59 // })); 45 // }));
60//}); 46}
61 47
62//app.configure('test', function () { 48app.set('port', 3001);
63 app.set('port', 3001);
64//});
65 49
66 // if ('production' == app.get('env')) { 50if ('production' == app.get('env')) {
67//app.configure('production', function () {
68 //app.use(express.errorHandler()); 51 //app.use(express.errorHandler());
69//}); 52}
70 // }
71 53
72String.prototype.commafy = function () { 54String.prototype.commafy = function () {
73 return this.replace(/(^|[^\w.])(\d{4,})/g, function($0, $1, $2) { 55 return this.replace(/(^|[^\w.])(\d{4,})/g, function($0, $1, $2) {
@@ -87,6 +69,8 @@ require('./apps/sidewalk/routes')(app);
87//require('./apps/authentication/routes')(app); 69//require('./apps/authentication/routes')(app);
88//require('./apps/admin/routes')(app); 70//require('./apps/admin/routes')(app);
89 71
72app.set('paths', ['/Volumes/Desktop', '/Volumes/Storage']);
73
90server.listen(app.get('port'), function(){ 74server.listen(app.get('port'), function(){
91 console.log('express listening on port ' + app.get('port')); 75 console.log('express listening on port ' + app.get('port'));
92}); 76});