Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM node:latest

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

RUN echo deb http://www.deb-multimedia.org jessie main non-free >> /etc/apt/sources.list
RUN echo deb-src http://www.deb-multimedia.org jessie main non-free >> /etc/apt/sources.list

# RUN apt-get install deb-multimedia-keyring

RUN apt-get update && apt-get install -y --force-yes \
python-pip \
ffmpeg \
libmp3lame0

COPY package.json /usr/src/app
RUN npm install

# RUN pip install \
# mutagen \
# PythonMagick \
# amazonproduct \
# python-itunes

COPY . /usr/src/app

EXPOSE 13001

CMD ["npm", "start"]
166 changes: 102 additions & 64 deletions htdocs/js/soundmanager2.min.js

Large diffs are not rendered by default.

Binary file modified htdocs/swf/soundmanager2.swf
Binary file not shown.
Binary file added htdocs/swf/soundmanager2_debug.swf
Binary file not shown.
Binary file modified htdocs/swf/soundmanager2_flash9.swf
Binary file not shown.
Binary file added htdocs/swf/soundmanager2_flash9_debug.swf
Binary file not shown.
2 changes: 1 addition & 1 deletion node_modules/cjbconfig.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "cjb",
"version": "1.0.0",
"description": "Collaborative Jukebox",
"author": "narwhalbacon",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "",
"formidable": "",
"socket.io": "",
"morgan": "",
"body-parser": "",
"cookie-parser": "",
"errorhandler": ""
}
}
76 changes: 40 additions & 36 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
var express = require('express')
,formidable = require('formidable')
,fs = require('fs')
,io = require('socket.io')
,util = require('util')
,util = require('util')
,morgan = require('morgan')
,bodyParser = require('body-parser')
,cookieParser = require('cookie-parser')
,errorhandler = require('errorhandler')
;

// cjb stuff
Expand All @@ -14,7 +17,7 @@ var cjbutil = require('cjbutil')
,names = require('names')
,sessions = require('sessions')
,queue = require('queue')
;
;

var state = { // holds the current state of things
scnt: 0
Expand All @@ -38,43 +41,44 @@ for(var i in directories) {
};
}

var app = express.createServer();
app.use(express.logger());
app.use(express.bodyParser());
app.use(express.cookieParser());
var app = express();
var server = require('http').Server(app);
var io = require('socket.io')(server);

app.use(morgan('combined'));
app.use(bodyParser());
app.use(cookieParser());

app.configure(function() {
app.use(express.static(__dirname + '/htdocs'));
app.use(express.errorHandler({
app.use(express.static(__dirname + '/htdocs'));
app.use(errorhandler({
dumpExceptions: true
,showStack: true
}));
});
}));

var socketio = io.listen(app);
socketio.enable('browser client minification');
socketio.enable('browser client etag');
socketio.set('log level', 1);
socketio.configure('development', function() {
socketio.disable('browser client minification');
socketio.disable('browser client etag');
socketio.set('log level', 3);
});

app.listen(config.server.port);
// io.enable('browser client minification');
// io.enable('browser client etag');
// io.set('log level', 1);
// socketio.configure('development', function() {
// socketio.disable('browser client minification');
// socketio.disable('browser client etag');
// socketio.set('log level', 3);
// });

server.listen(config.server.port);

// add our own little function
socketio.cjbnotify = function(message) {
io.cjbnotify = function(message) {
history.enqueueChat('NOTICE', message);
this.sockets.emit('NOTICE', message);
}

history.setSocketIO(socketio);
queue.setSocketIO(socketio);
history.setSocketIO(io);
queue.setSocketIO(io);

socketio.cjbnotify('server started');
io.cjbnotify('server started');

socketio.sockets.on('connection', function(socket) {
io.sockets.on('connection', function(socket) {
var session = sessions.create(socket.id);

socket.on('disconnect', function() {
Expand All @@ -83,8 +87,8 @@ socketio.sockets.on('connection', function(socket) {
+' '+session.uuid
+':'+session.name);
// +':'+socket.connection.remoteAddress);
//socketio.cjbnotify(session.name+' has left');
socketio.sockets.emit('PART', session.uuid);
//io.cjbnotify(session.name+' has left');
io.sockets.emit('PART', session.uuid);
}
sessions.destroy(socket.id);
});
Expand Down Expand Up @@ -112,8 +116,8 @@ socketio.sockets.on('connection', function(socket) {
// +':'+socket.connection.remoteAddress);

// only broadcast to everyone if new connection
//socketio.cjbnotify(session.name+' has joined');
socketio.sockets.emit('JOIN', {
//io.cjbnotify(session.name+' has joined');
io.sockets.emit('JOIN', {
uuid:session.uuid
,name:session.name
});
Expand Down Expand Up @@ -144,14 +148,14 @@ socketio.sockets.on('connection', function(socket) {
} else {
message += 'to: '+theme;
}
socketio.cjbnotify(message);
io.cjbnotify(message);
history.setTheme(theme);
} else {
history.enqueueChat(
'MSG'
,{name:session.name, message:message}
);
socketio.sockets.emit('MSG', {
io.sockets.emit('MSG', {
uuid:session.uuid
, message:message
});
Expand All @@ -169,8 +173,8 @@ socketio.sockets.on('connection', function(socket) {
session.name = sanitized;

util.log(message);
socketio.cjbnotify(message);
socketio.sockets.emit('NICK', {
io.cjbnotify(message);
io.sockets.emit('NICK', {
uuid:session.uuid
,name:session.name
});
Expand Down Expand Up @@ -215,7 +219,7 @@ app.post('/upload', function(req,res) {
song.progress = bytesExpected ?
Math.floor((bytesReceived/bytesExpected)*100) : 0;
song.ts = new Date().getTime();
socketio.sockets.volatile.emit('UPDATE', song);
io.sockets.volatile.emit('UPDATE', song);
});

form.on('end', function() {
Expand Down