-
diff --git a/SKININNG.md b/docs/SKININNG.md similarity index 100% rename from SKININNG.md rename to docs/SKININNG.md diff --git a/exampleJSON/allOptions.json b/docs/exampleJSON/allOptions.json similarity index 100% rename from exampleJSON/allOptions.json rename to docs/exampleJSON/allOptions.json diff --git a/exampleJSON/exampleNewJSON.json b/docs/exampleJSON/exampleNewJSON.json similarity index 100% rename from exampleJSON/exampleNewJSON.json rename to docs/exampleJSON/exampleNewJSON.json diff --git a/exampleJSON/remote.json b/docs/exampleJSON/remote.json similarity index 100% rename from exampleJSON/remote.json rename to docs/exampleJSON/remote.json diff --git a/exampleJSON/skeleton.json b/docs/exampleJSON/skeleton.json similarity index 100% rename from exampleJSON/skeleton.json rename to docs/exampleJSON/skeleton.json diff --git a/modules/configure-json-file.js b/modules/configure-json-file.js index db00e8e..8474949 100644 --- a/modules/configure-json-file.js +++ b/modules/configure-json-file.js @@ -15,6 +15,11 @@ exports.setup = function(args, rootDir){ return {error:"Failed to parse JSON file"}; } + console.log(loadJson); + console.log(loadJson); + console.log(loadJson); + + if(!loadJson.port){ loadJson.port = 5050; diff --git a/modules/jukebox.js b/modules/jukebox.js new file mode 100644 index 0000000..6e908c1 --- /dev/null +++ b/modules/jukebox.js @@ -0,0 +1,99 @@ +// TODO: Properly integrate this +//https://gist.github.com/martinsik/2031681 + +// Websocket Server +const WebSocketServer = require('ws').Server; + + + +// list of currently connected clients (users) +var clients = { }; + + +exports.setup = function(mstream, server, program){ + const wss = new WebSocketServer({ server: server }); + // This callback function is called every time someone + // tries to connect to the WebSocket server + wss.on('connection', function(connection) { + + // accept connection - you should check 'request.origin' to make sure that + // client is connecting from your website + // var connection = request.accept(null, request.origin); + console.log((new Date()) + ' Connection accepted.'); + + + // Generate code and assure it doesn't exist + var code; + var n = 0; + while (true) { + code = Math.floor(Math.random()*90000) + 10000; + if(!(code in clients)){ + break; + } + if(n === 10){ + console.log('Failed to create ID for jukebox.'); + // FIXME: Close connection + return; + } + n++; + } + + // Send Code + connection.send(JSON.stringify( { code: code} )); + // Add code to clients object + clients[code] = connection; + + + // user sent some message + connection.on('message', function(message) { + if (message.type === 'utf8') { // accept only text + // Send client code back + connection.send(JSON.stringify( { code: code} )); + + // FIXME: Will need some work to add more commands + } + }); + + // user disconnected + connection.on('close', function(connection) { + // Remove client from array + delete clients[code]; + }); + + }); + + + + // TODO: Get Album Art calls + mstream.post( '/push-to-client', function(req, res){ + // Get client id + console.log(req.body.json); + const json = JSON.parse(req.body.json); + console.log(json); + console.log(json.code); + console.log(json.command); + + + // Check if client ID exists + const clientCode = json.code; + const command = json.command; + console.log(clientCode); + console.log(clientCode); + console.log(clientCode); + console.log(command); + + + if(!(clientCode in clients)){ + res.status(500).json({ error: 'Client code not found' }); + } + + // TODO: Check if command logic makes sense + + // Push commands to client + clients[clientCode].send(JSON.stringify({command:command})); + + // Send confirmation back to user + res.json({ status: 'done' }); + }); + +} diff --git a/mstream.js b/mstream.js index 7a2174a..ae374b6 100755 --- a/mstream.js +++ b/mstream.js @@ -400,8 +400,8 @@ mstream.post('/download', function (req, res){ // ============================================================================ -// // New Way -// // TODO: We need to pull this from the program var +// New Way +// We need to pull this from the program var var dbSettings = program.database_plugin; const mstreamDB = require('./modules/db-management/database-master.js'); mstreamDB.setup(mstream, program); @@ -426,92 +426,10 @@ mstream.post( '/get-album-art', function(req, res){ }); -// TODO: Properly integrate this -//https://gist.github.com/martinsik/2031681 - -// Websocket Server -const WebSocketServer = require('ws').Server; -const wss = new WebSocketServer({ server: server }); - - -// list of currently connected clients (users) -var clients = { }; - -// This callback function is called every time someone -// tries to connect to the WebSocket server -wss.on('connection', function(connection) { - - // accept connection - you should check 'request.origin' to make sure that - // client is connecting from your website - // var connection = request.accept(null, request.origin); - console.log((new Date()) + ' Connection accepted.'); - - - // Generate code and assure it doesn't exist - var code; - var n = 0; - while (true) { - code = Math.floor(Math.random()*90000) + 10000; - if(!(code in clients)){ - break; - } - if(n === 10){ - console.log('Failed to create ID for jukebox.'); - // FIXME: Close connection - return; - } - n++; - } - - // Send Code - connection.send(JSON.stringify( { code: code} )); - // Add code to clients object - clients[code] = connection; - - - // user sent some message - connection.on('message', function(message) { - if (message.type === 'utf8') { // accept only text - // Send client code back - connection.send(JSON.stringify( { code: code} )); - - // FIXME: Will need some work to add more commands - } - }); - - // user disconnected - connection.on('close', function(connection) { - // Remove client from array - delete clients[code]; - }); - -}); - - - -// TODO: Get Album Art calls -mstream.post( '/push-to-client', function(req, res){ - // Get client id - console.log(req.body.json); - const json = JSON.parse(req.body.json); - console.log(json); - // Check if client ID exists - const clientCode = json.code; - const command = json.command; - - if(!(clientCode in clients)){ - res.status(500).json({ error: 'Client code not found' }); - } - - // TODO: Check if command logic makes sense - - // Push commands to client - clients[clientCode].send(JSON.stringify({command:command})); - - // Send confirmation back to user - res.json({ status: 'done' }); -}); +// JukeBox +const jukebox = require('./modules/jukebox.js'); +jukebox.setup(mstream, server, program); diff --git a/public-shared/css/shared.css b/public-shared/css/shared.css index 56a4a13..9c212f9 100644 --- a/public-shared/css/shared.css +++ b/public-shared/css/shared.css @@ -9,9 +9,23 @@ body{ .header{ margin: 0; padding: 0; - overflow: hidden; background-color: #333; - height:20px; + height:25px; +} + +.mstream-image{ + height:100%; + background-color: white; + border-radius: 0 0 3px 3px; + box-shadow: 0 0 5px #8D8D8D; +} + +.logo-box{ + overflow-y: visible; + width: 1px; + height: 140%; + margin-left: 35px; + z-index: 99; } .playlist-header{ @@ -34,6 +48,7 @@ body{ overflow-y: scroll; height:calc(100% - 120px); background-color: rgba(250,250,250, .50); + font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; } #playlist{ @@ -42,8 +57,8 @@ body{ } .playlist-item{ - height:30px; - border-bottom: 1px solid black; + height:auto; + border-bottom:solid 1px #b4b4b4; cursor: pointer; width: 100%; @@ -144,10 +159,12 @@ body{ background-color: rgba(255,0,0, .85); } .song-area{ - height: 100%; display: block; - width: calc(100% - 29px); + width: calc(100% - 49px); float: left; + padding-top: 12px; + padding-bottom: 10px; + padding-left: 12px; } @@ -183,7 +200,7 @@ body{ font-style: normal; margin-top: 3px; - margin-left: 5px; + margin-left: 2px; padding-bottom: 17px; /* This pushes the scr */ overflow-x: scroll; diff --git a/public-shared/img/mstream-logo.svg b/public-shared/img/mstream-logo.svg new file mode 100644 index 0000000..164177d --- /dev/null +++ b/public-shared/img/mstream-logo.svg @@ -0,0 +1,34 @@ + + + diff --git a/public-shared/mstream.html b/public-shared/mstream.html index 6a99ebe..226aec8 100644 --- a/public-shared/mstream.html +++ b/public-shared/mstream.html @@ -206,6 +206,7 @@ // Check the key switch (event.keyCode) { case 32: //SpaceBar + event.preventDefault(); MSTREAM.playPause(); break; } @@ -219,7 +220,9 @@
- - {{item}} - -
-[[pressed]]- -
value stored at key="info" is .
-
- only type cats:
-
-
-
- valid
- invalid
-
Once started, loops 5 times before stopping.
-
-
- Grumpy wizards make toxic brew for the evil Queen and Jack. -
-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi - tincidunt dui sit amet mi auctor, ac gravida magna aliquam. Fusce quis - purus elementum, tempus nisi vel, volutpat nulla. Vestibulum mollis - dictum tellus, vulputate porttitor arcu. Curabitur imperdiet risus id - egestas accumsan. Donec lectus felis, dignissim id iaculis sit amet, - faucibus in leo. -
-- Mauris id urna ac ante ultrices commodo a imperdiet elit. Vivamus - interdum neque magna, eget dapibus est auctor et. Donec accumsan - libero nec augue scelerisque, ac egestas ante tincidunt. Proin - sollicitudin, mi eget sagittis mollis, arcu orci scelerisque turpis, a - sollicitudin tellus quam non sapien. -
-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi - tincidunt dui sit amet mi auctor, ac gravida magna aliquam. Fusce quis - purus elementum, tempus nisi vel, volutpat nulla. Vestibulum mollis - dictum tellus, vulputate porttitor arcu. Curabitur imperdiet risus id - egestas accumsan. Donec lectus felis, dignissim id iaculis sit amet, - faucibus in leo. -
-- Mauris id urna ac ante ultrices commodo a imperdiet elit. Vivamus - interdum neque magna, eget dapibus est auctor et. Donec accumsan - libero nec augue scelerisque, ac egestas ante tincidunt. Proin - sollicitudin, mi eget sagittis mollis, arcu orci scelerisque turpis, a - sollicitudin tellus quam non sapien. -
-