From 81537d81a48ffa4549a9c0ce12946d36f8630f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20B=C3=B6ttcher?= Date: Thu, 3 Dec 2015 11:07:01 +0100 Subject: [PATCH 01/10] Add NeDB to deps --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index ffd278d..182cc29 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "mongoose": "^4.1.0", "mongoose-construct": "0.0.1", "mopidy": "^0.5.0", + "nedb": "^1.5.0", "q": "^1.3.0", "socket.io": "^1.3.6" }, From 813efd5de279003d5ed910eeeacdaa84e74f41cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20B=C3=B6ttcher?= Date: Thu, 3 Dec 2015 11:27:18 +0100 Subject: [PATCH 02/10] Setup neDB config --- config.js | 5 ++++- server.js | 38 ++++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/config.js b/config.js index dee3e71..1257e1c 100644 --- a/config.js +++ b/config.js @@ -10,7 +10,10 @@ var config = { adress: 'ws://127.0.0.1:6680/mopidy/ws/', defaultPlaylist: 'Party 2015' }, - db: 'mongodb://localhost/livid', + db: { + queuePath: 'queue.db', + historyPath: 'history.db' + }, user: { voteDelay: 60 * 1000 } diff --git a/server.js b/server.js index f75ecf4..954ead5 100644 --- a/server.js +++ b/server.js @@ -1,34 +1,37 @@ var Hapi = require('hapi'), server = new Hapi.Server(), - mongoose = require('mongoose'), + nedb = require('nedb'), glob = require('glob'); +// Load configfile var config = require('./config.js'); -server.connection({ port: config.main.port }); -mongoose.connect(config.db); -var db = mongoose.connection; -db.on('error', function () { - throw new Error('unable to connect to database at ' + config.db); -}); +// Load database +var db = {}; +db.queue = new nedb({ filename: config.db.queuePath, autoload: true }); +db.history = new nedb({ filename: config.db.historyPath, autoload: true }); + -var models = glob.sync('./models/*.js'); -models.forEach(function (model) { - require(model); -}); -if (process.env.ENV !== 'prod') { - mongoose.connection.collections['queuetracks'].drop( function(err) { - console.log('old queue tracks dropped'); - }); -} +// var models = glob.sync('./models/*.js'); +// models.forEach(function (model) { +// require(model); +// }); +// if (process.env.ENV !== 'prod') { +// mongoose.connection.collections['queuetracks'].drop( function(err) { +// console.log('old queue tracks dropped'); +// }); +// } + +/* var socket = require('./modules/socketLogic.js'); socket.init(server.listener); var mopidy = require('./modules/mopidyCom.js'); mopidy.init(); +*/ server.views({ engines: { @@ -75,6 +78,9 @@ server.route({ }); +// Configure hapi server +server.connection({ port: config.main.port }); + server.start(function () { console.log('Server running at:', server.info.uri); }); From 8ecb1ef6740545d3f7aa654e67a8180f5117c3fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20B=C3=B6ttcher?= Date: Thu, 3 Dec 2015 11:27:25 +0100 Subject: [PATCH 03/10] Some commenting --- server.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 954ead5..ccd6037 100644 --- a/server.js +++ b/server.js @@ -44,7 +44,10 @@ server.views({ } }); - +/* + * Set routes + */ +// root server.route({ method: 'GET', path: '/', @@ -55,7 +58,7 @@ server.route({ } }); - +// History page server.route({ method: 'GET', path: '/history', From 376fec06a26845ce580fc057b280b43227fd854e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20B=C3=B6ttcher?= Date: Fri, 4 Dec 2015 16:36:04 +0100 Subject: [PATCH 04/10] Move to node 4.2.3, add/update deps --- package.json | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 182cc29..545de26 100644 --- a/package.json +++ b/package.json @@ -15,21 +15,27 @@ "bugs": { "url": "https://github.com/eljenso/party-mate/issues" }, + "engines" : { + "node" : "4.2.3" + }, "dependencies": { - "glob": "^5.0.14", - "hapi": "^8.8.0", + "glob": "^6.0.1", + "hapi": "^11.x", + "hapio": "^1.3.1", + "inert": "^3.2.0", "jade": "^1.9.2", "mongoose": "^4.1.0", "mongoose-construct": "0.0.1", "mopidy": "^0.5.0", "nedb": "^1.5.0", "q": "^1.3.0", - "socket.io": "^1.3.6" + "socket.io": "^1.3.7", + "vision": "^4.0.1" }, "devDependencies": { "gulp": "^3.8.11", "gulp-livereload": "^3.8.0", "gulp-nodemon": "^2.0.3", - "gulp-node-debug": "0.0.2" + "gulp-node-debug": "0.0.3" } } From 2c46deb823f20cc1ef463c4034ade7f67a213b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20B=C3=B6ttcher?= Date: Fri, 4 Dec 2015 16:36:17 +0100 Subject: [PATCH 05/10] Move unused models --- models/historyTrack.js | 30 ------------------------------ models/queueTrack.js | 38 -------------------------------------- 2 files changed, 68 deletions(-) delete mode 100644 models/historyTrack.js delete mode 100644 models/queueTrack.js diff --git a/models/historyTrack.js b/models/historyTrack.js deleted file mode 100644 index 5516218..0000000 --- a/models/historyTrack.js +++ /dev/null @@ -1,30 +0,0 @@ -var mongoose = require('mongoose'), - construct = require('mongoose-construct'), - Schema = mongoose.Schema; - - -var HistoryTrackSchema = new Schema({ - artist: String, - name: String, - uri: String, - rating: Number, - imageUri: String, - timePlayed: { type: Date, default: Date.now } -}); -HistoryTrackSchema.plugin(construct); - - -HistoryTrackSchema.statics.convert = function (queueTrack, cb) { - var historyTrackSchema = { - artist: queueTrack.artist, - name: queueTrack.name, - uri: queueTrack.uri, - rating: queueTrack.rating, - imageUri: queueTrack.imageUri - }; - - cb(historyTrackSchema); -}; - - -mongoose.model('HistoryTrack', HistoryTrackSchema); diff --git a/models/queueTrack.js b/models/queueTrack.js deleted file mode 100644 index a20af6a..0000000 --- a/models/queueTrack.js +++ /dev/null @@ -1,38 +0,0 @@ -var mongoose = require('mongoose'), - construct = require('mongoose-construct'), - Schema = mongoose.Schema; - - -var QueueTrackSchema = new Schema({ - artist: String, - name: String, - uri: String, - rating: Number, - imageUri: String, - length: Number, - dateAdded: { type: Date, default: Date.now } -}); -QueueTrackSchema.plugin(construct); - - -QueueTrackSchema.statics.convert = function (mopidyTrack, cb) { - var queueTrackSchema = { - artist: mopidyTrack.artists[0].name, - name: mopidyTrack.name, - uri: mopidyTrack.uri, - rating: 0, - imageUri: '', - length: mopidyTrack.length - }; - - if (mopidyTrack.artists.length > 1) { - for (var i = 1; i < mopidyTrack.artists.length; i++) { - queueTrackSchema.artist += ', ' + mopidyTrack.artists[i].name; - }; - }; - - cb(queueTrackSchema); -}; - - -mongoose.model('QueueTrack', QueueTrackSchema); From 9c0cfd2d702f95071978cac24bae2897bd0eb58d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20B=C3=B6ttcher?= Date: Fri, 4 Dec 2015 16:36:49 +0100 Subject: [PATCH 06/10] Add model for tracks and the DB handler --- modules/dbHandler.js | 110 +++++++++++++++++++++++++++++++++++++++++++ modules/models.js | 55 ++++++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 modules/dbHandler.js create mode 100644 modules/models.js diff --git a/modules/dbHandler.js b/modules/dbHandler.js new file mode 100644 index 0000000..f71f1e7 --- /dev/null +++ b/modules/dbHandler.js @@ -0,0 +1,110 @@ +var nedb = require('nedb'), + Q = require('q'); + +// Load configfile +var config = require('../config.js'); + +// Load database +var db = {}; +db.queue = new nedb({ filename: config.db.queuePath, autoload: true, timestampData: true }); +db.history = new nedb({ filename: config.db.historyPath, autoload: true, timestampData: true }); + +db.queue.ensureIndex({fieldName: 'uri', unique: true}, function (err) { + if (err) throw err; +}); +db.history.ensureIndex({fieldName: 'uri', unique: true}, function (err) { + if (err) throw err; +}); + + +function getTracks(uri, dbName, limit) { + var deferred = Q.defer(); + + if (typeof dbName === 'undefined') dbName = 'queue'; + if (typeof limit === 'undefined') limit = 10; + + db[dbName].find({ uri: uri }).sort({ createdAt: -1 }).limit(limit).exec(function (err, tracks) { + if (err) deferred.reject(err); + deferred.resolve(tracks); + }); + + return deferred.promise; +}; + + +function getTrack(uri, dbName) { + var deferred = Q.defer(); + + if (typeof dbName === 'undefined') dbName = 'queue'; + + db[dbName].findOne({ uri: uri }).exec(function (err, track) { + if (err) deferred.reject(err); + deferred.resolve(track); + }); + + return deferred.promise; +}; + + +function getNextTracks(dbName, limit) { + var deferred = Q.defer(); + + if (typeof dbName === 'undefined') dbName = 'queue'; + if (typeof limit === 'undefined') limit = 10; + + db[dbName].find({}).sort({ rating: -1 }).limit(limit).exec(function (err, tracks) { + if (err) deferred.reject(err); + deferred.resolve(tracks); + }); + + return deferred.promise; +} + + +function saveTrack(track, dbName) { + var deferred = Q.defer(); + + if (typeof dbName === 'undefined') dbName = 'queue'; + + db[dbName].insert(track, function (err, savedTrack) { + if (err) console.log(err); + deferred.resolve(savedTrack); + }); + return deferred.promise; +}; + + +function deleteTrack(uri, dbName) { + var deferred = Q.defer(); + + if (typeof dbName === 'undefined') dbName = 'queue'; + + db[dbName].remove({ uri: uri }, function (err) { + if (err) deferred.reject(err); + deferred.resolve(); + }); + + return deferred.promise; +}; + + +function voteUp(uri, dbName) { + var deferred = Q.defer(); + + if (typeof dbName === 'undefined') dbName = 'queue'; + + db[dbName].update({ uri: uri }, {$inc: {rating: 1} }, function (err, track) { + if (err) deferred.reject(err); + deferred.resolve(track); + }); + + return deferred.promise; +}; + + +exports.getTrack = getTrack; +exports.saveTrack = saveTrack; +exports.deleteTrack = deleteTrack; +exports.getTracks = getTracks; +exports.voteUp = voteUp; +exports.getNextTracks = getNextTracks; diff --git a/modules/models.js b/modules/models.js new file mode 100644 index 0000000..e2e701f --- /dev/null +++ b/modules/models.js @@ -0,0 +1,55 @@ +var Q = require('q'); + +function Track(artist, name, uri, rating, imageUri, length) { + this.artist = artist, + this.name = name, + this.uri = uri, + this.rating = rating, + this.imageUri = imageUri, + this.length = length || 0 +} + +/* +Track.prototype.convert = function (queueTrack, cb) { + var historyTrack = new Track( + queueTrack.artist, + queueTrack.name, + queueTrack.uri, + queueTrack.rating, + queueTrack.imageUri + ); + + cb(historyTrack); +}; + +Track.prototype.convert1 = function (mopidyTrack, cb) { + var queueTrack = new Track( + mopidyTrack.artist, + mopidyTrack.name, + mopidyTrack.uri, + mopidyTrack.rating, + mopidyTrack.imageUri, + mopidyTrack.length + ); + + var queueTrackSchema = { + artist: mopidyTrack.artists[0].name, + name: mopidyTrack.name, + uri: mopidyTrack.uri, + rating: 0, + imageUri: '', + length: mopidyTrack.length + }; + + if (mopidyTrack.artists.length > 1) { + for (var i = 1; i < mopidyTrack.artists.length; i++) { + queueTrackSchema.artist += ', ' + mopidyTrack.artists[i].name; + }; + }; + + cb(queueTrackSchema); +}; +*/ + + +exports.Track = Track; From f6c7d6ccfb318484e17c823670559e3cf341a054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20B=C3=B6ttcher?= Date: Fri, 4 Dec 2015 16:38:25 +0100 Subject: [PATCH 07/10] Adjust for new hapi version --- modules/socketLogic.js | 4 +-- server.js | 71 ++++++++++++++++++++++++++++-------------- 2 files changed, 49 insertions(+), 26 deletions(-) diff --git a/modules/socketLogic.js b/modules/socketLogic.js index 97f7436..e487be2 100644 --- a/modules/socketLogic.js +++ b/modules/socketLogic.js @@ -42,8 +42,8 @@ function sendTrack (isCurrent, track) { io.sockets.emit(broadcastEvent, track); } -function init(listener) { - io = socketIO(listener); +function init(hapio) { + io = hapio; io.on('connection', function (socket) { diff --git a/server.js b/server.js index ccd6037..b8407c5 100644 --- a/server.js +++ b/server.js @@ -31,19 +31,56 @@ socket.init(server.listener); var mopidy = require('./modules/mopidyCom.js'); mopidy.init(); -*/ - -server.views({ - engines: { - jade: require('jade') - }, - relativeTo: __dirname, - path: 'views', - context: { - website: 'Livid' + +// Configure hapi server +server.connection({ port: config.main.port }); + +var socket; +server.register(require('hapio'), function(err) { + if (err) throw err; + socket = require('./modules/socketLogic.js'); + socket.init(server.plugins.hapio.io); +}); + + +// View engine +server.register(require('vision'), function (err) { + if (err) { + throw err; } + + server.views({ + engines: { + jade: require('jade') + }, + relativeTo: __dirname, + path: 'views', + context: { + website: 'Livid' + } + }); }); +// Static files +server.register(require('inert'), function (err) { + + if (err) { + throw err; + } + + // Static files + server.route({ + method: 'GET', + path: '/public/{param*}', + handler: { + directory: { + path: 'public' + } + } + }); +}); + + /* * Set routes */ @@ -69,20 +106,6 @@ server.route({ } }); -// Static files -server.route({ - method: 'GET', - path: '/public/{param*}', - handler: { - directory: { - path: 'public' - } - } -}); - - -// Configure hapi server -server.connection({ port: config.main.port }); server.start(function () { console.log('Server running at:', server.info.uri); From 8a273e1230bd960317e707852fc7fe8452656e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20B=C3=B6ttcher?= Date: Fri, 4 Dec 2015 16:39:37 +0100 Subject: [PATCH 08/10] Use NeDB instead of mongo --- modules/historyManager.js | 30 +++++---- modules/mopidyCom.js | 57 +++++++++++------ modules/playlistManager.js | 123 ++++++++++++++++++++----------------- server.js | 22 ------- 4 files changed, 117 insertions(+), 115 deletions(-) diff --git a/modules/historyManager.js b/modules/historyManager.js index 5d805b8..9c15204 100644 --- a/modules/historyManager.js +++ b/modules/historyManager.js @@ -1,23 +1,21 @@ -var Q = require('q'), - mongoose = require('mongoose'), - QueueTrack = mongoose.model('QueueTrack'), - HistoryTrack = mongoose.model('HistoryTrack'); +var Q = require('q'); function addToHistory(trackUri) { var deferred = Q.defer(); - QueueTrack.findOne({ 'uri': trackUri }, function (err, track) { - if (err) return console.error(err); - HistoryTrack.convert(track, function(convertedTrack) { - var historyTrack = new HistoryTrack(convertedTrack); - - historyTrack.save(function (err, savedTrack) { - if (err) return console.error(err); - deferred.resolve(); - }); - }) - - }); + // QueueTrack.findOne({ 'uri': trackUri }, function (err, track) { + // if (err) return console.error(err); + // HistoryTrack.convert(track, function(convertedTrack) { + // var historyTrack = new HistoryTrack(convertedTrack); + // + // historyTrack.save(function (err, savedTrack) { + // if (err) return console.error(err); + // deferred.resolve(); + // }); + // }) + // + // }); + deferred.resolve(); return deferred.promise; } diff --git a/modules/mopidyCom.js b/modules/mopidyCom.js index 9429c83..04628a3 100644 --- a/modules/mopidyCom.js +++ b/modules/mopidyCom.js @@ -1,9 +1,8 @@ var Q = require('q'), Mopidy = require('mopidy'), - config = require('../config.js'), - mongoose = require('mongoose'), - QueueTrack = mongoose.model('QueueTrack'), - HistoryTrack = mongoose.model('HistoryTrack'); + config = require('../config.js'); + +var models = require('./models.js'); var playlistManager = require('./playlistManager.js'), historyManager = require('./historyManager.js'), @@ -54,9 +53,16 @@ function init () { mopidy.on('event:trackPlaybackStarted', function (track) { track = track.tl_track.track; - QueueTrack.convert(track, function (currentTrack) { - socket.sendTrack(true, currentTrack); - }); + var currentTrack = new models.Track( + track.artists[0].name, + track.name, + track.uri, + 0, + '', + track.length + ); + + socket.sendTrack(true, currentTrack); socket.broadcastUpcomingTracks(); @@ -73,9 +79,14 @@ function getCurrentTrack () { mopidy.playback.getCurrentTrack() .then(function (track) { if (track) { - QueueTrack.convert(track, function (currentTrack) { - deferred.resolve(currentTrack); - }) + deferred.resolve(new models.Track( + track.artists[0].name, + track.name, + track.uri, + 0, + '', + track.length + )); } else { deferred.reject('No current track'); } @@ -124,12 +135,12 @@ function queueNextTrack (isInit) { // 5 seconds before the current track stops, queue next track setTimeout(function () { queueNextTrack(); - }, nextTracks[0]._doc.length - (firstSong ? 10*1000 : 0)); + }, nextTracks[0].length - (firstSong ? 10*1000 : 0)); firstSong = false; - socket.sendTrack(false, nextTracks[0]._doc); + socket.sendTrack(false, nextTracks[0]); socket.broadcastUpcomingTracks(); - trackUri = nextTracks[0]._doc.uri; - return mopidy.tracklist.add(null, null, nextTracks[0]._doc.uri, null); + trackUri = nextTracks[0].uri; + return mopidy.tracklist.add(null, null, nextTracks[0].uri, null); }) .then(function () { return historyManager.addToHistory(trackUri); @@ -180,13 +191,19 @@ function searchTrack (query) { var convertedResults = []; for (var i = 0; i < concatenatedResults.length; i++) { - QueueTrack.convert(concatenatedResults[i], function (currentTrack) { - convertedResults.push(currentTrack); + convertedResults.push(new models.Track( + concatenatedResults[i].artists[0].name, + concatenatedResults[i].name, + concatenatedResults[i].uri, + 0, + '', + concatenatedResults[i].length + )); + + if (concatenatedResults.length === convertedResults.length) { + deferred.resolve(convertedResults); + }; - if (concatenatedResults.length === convertedResults.length) { - deferred.resolve(convertedResults); - }; - }) }; }) .done(); diff --git a/modules/playlistManager.js b/modules/playlistManager.js index a46844f..079c19a 100644 --- a/modules/playlistManager.js +++ b/modules/playlistManager.js @@ -1,9 +1,11 @@ var Q = require('q'), - config = require('../config.js'), - mongoose = require('mongoose'), - QueueTrack = mongoose.model('QueueTrack'); + nedb = require('nedb'), + config = require('../config.js'); + +var dbHandler = require('../modules/dbHandler.js'); var socket = require('./socketLogic.js'); +var models = require('../modules/models.js'); var playlistManager = { defaultTracks: [] @@ -29,17 +31,26 @@ playlistManager.repopulateDB = function (tracks) { var savedTracks = 0; for (var i = tracks.length - 1; i >= 0; i--) { - QueueTrack.convert(tracks[i], function (track) { - track = new QueueTrack(track); - - track.save(function (err, track) { - if (err) return console.error(err); + var track = new models.Track( + tracks[i].artists[0].name, + tracks[i].name, + tracks[i].uri, + 0, + '', + tracks[i].length + ); + + dbHandler.saveTrack(track) + .then(function(savedTrack) { savedTracks++; if (savedTracks === tracks.length) { deferred.resolve(); }; - }); - }); + }) + .fail(function(err) { + deferred.reject(err); + }) + .done(); }; return deferred.promise; @@ -53,23 +64,14 @@ playlistManager.getNextTracks = function (numberOfTracks) { numberOfTracks = 10; }; - var query = QueueTrack.find().sort('-rating dateAdded').limit(numberOfTracks); - var promise = query.exec(); - promise.addBack(function (err, tracks) { - if (err) return console.error(err); - if (tracks.length < numberOfTracks) { - playlistManager.repopulateDB() - .then(function () { - return playlistManager.getNextTracks(numberOfTracks); - }) - .then(function (nextTracks) { - deferred.resolve(nextTracks); - }) - .done(); - } else { - deferred.resolve(tracks); - } - }); + dbHandler.getNextTracks('queue', numberOfTracks) + .then(function (nextTracks) { + deferred.resolve(nextTracks); + }) + .fail(function(err) { + deferred.reject(err); + }) + .done(); return deferred.promise; } @@ -78,45 +80,52 @@ playlistManager.getNextTracks = function (numberOfTracks) { playlistManager.removeNextTrack = function() { playlistManager.getNextTracks(1) .then(function (nextTracks) { - QueueTrack.remove({uri: nextTracks[0]._doc.uri}, function (err) { - if (err) return console.error(err); - }); + return dbHandler.deleteTrack(nextTracks[0].uri); + }) + .fail(function(err) { + if (err) return console.error(err); }) .done(); -} +}; playlistManager.addTrack = function(newTrack) { - QueueTrack.findOne({ 'uri': newTrack.uri }, function (err, track) { - if (err) return console.error(err); - - // Only add track if not already in queue - if (track) { - // Vote track up if already in queue - playlistManager.voteUp(newTrack.uri); - } else { - track = new QueueTrack(newTrack); - - track.save(function (err, track) { - if (err) return console.error(err); - socket.broadcastUpcomingTracks(); - }); - } - }); -} + dbHandler.getTrack(newTrack.uri) + .then(function(track) { + // Only add track if not already in queue + if (track) { + // Vote track up if already in queue + playlistManager.voteUp(newTrack.uri); + } else { + track = new QueueTrack(newTrack); + + return dbHandler.saveTrack(track) + .then(function(savedTrack) { + socket.broadcastUpcomingTracks(); + }) + .fail(function(err) { + deferred.reject(err); + }) + .done(); + } + }) + .fail(function(err) { + if (err) return console.error(err); + }) + .done(); +}; playlistManager.voteUp = function (trackUri) { - QueueTrack.findOne({ 'uri': trackUri }, function (err, track) { - if (err) return console.error(err); - - track.rating++; - track.save(function (err, track) { - if (err) return console.error(err); + dbHandler.voteUp(trackUri, 'queue') + .then(function(newTrack) { socket.broadcastUpcomingTracks(); - }); - }); -} + }) + .fail(function(err) { + if (err) return console.error(err); + }) + .done(); +}; exports.setDefaultTracks = playlistManager.setDefaultTracks; diff --git a/server.js b/server.js index b8407c5..039d668 100644 --- a/server.js +++ b/server.js @@ -1,33 +1,11 @@ var Hapi = require('hapi'), server = new Hapi.Server(), - nedb = require('nedb'), glob = require('glob'); // Load configfile var config = require('./config.js'); -// Load database -var db = {}; -db.queue = new nedb({ filename: config.db.queuePath, autoload: true }); -db.history = new nedb({ filename: config.db.historyPath, autoload: true }); - - - -// var models = glob.sync('./models/*.js'); -// models.forEach(function (model) { -// require(model); -// }); - -// if (process.env.ENV !== 'prod') { -// mongoose.connection.collections['queuetracks'].drop( function(err) { -// console.log('old queue tracks dropped'); -// }); -// } - -/* -var socket = require('./modules/socketLogic.js'); -socket.init(server.listener); var mopidy = require('./modules/mopidyCom.js'); mopidy.init(); From 6263adaa7c131692f23d78d9cdc61970c9904863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20B=C3=B6ttcher?= Date: Fri, 4 Dec 2015 16:40:25 +0100 Subject: [PATCH 09/10] Add DB files to gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 93ff32d..8a7b402 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ public/vendor /output.txt /err.txt + +*.db From d493ca8e3c3bc908bc09557dd599f031df768de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20B=C3=B6ttcher?= Date: Fri, 4 Dec 2015 16:40:36 +0100 Subject: [PATCH 10/10] Rename gulp develop task to dev --- gulpfile.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index b22129e..070931f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -5,7 +5,7 @@ var gulp = require('gulp'), -gulp.task('develop', function () { +gulp.task('dev', function () { livereload.listen(); nodemon({ @@ -20,8 +20,9 @@ gulp.task('develop', function () { this.stderr.pipe(fs.createWriteStream('err.txt')); livereload.reload(); - } -)}); + }); + +}); gulp.task('default', function () { nodemon({