diff --git a/cli-boot-wrapper.js b/cli-boot-wrapper.js index daaad78..4341ef1 100755 --- a/cli-boot-wrapper.js +++ b/cli-boot-wrapper.js @@ -25,7 +25,7 @@ if (config.error) { const colors = require('colors'); console.clear(); console.log(colors.bold(` - v4.5.4 ____ _ + v4.6.0 ____ _ _ __ ___ / ___|| |_ _ __ ___ __ _ _ __ ___ | '_ \` _ \\\\___ \\| __| '__/ _ \\/ _\` | '_ \` _ \\ | | | | | |___) | |_| | | __/ (_| | | | | | | diff --git a/modules/db-read/database-public-loki.js b/modules/db-read/database-public-loki.js index ada781f..6664f77 100644 --- a/modules/db-read/database-public-loki.js +++ b/modules/db-read/database-public-loki.js @@ -463,8 +463,7 @@ exports.setup = function (mstream, program) { res.status(500).json({ error: 'No files in DB' }); return; }; - // Ignore songs with star rating of 2 or under - let ignoreRating = false; + // Ignore list let ignoreList = []; if (req.body.ignoreList && Array.isArray(req.body.ignoreList)) { @@ -472,33 +471,34 @@ exports.setup = function (mstream, program) { } let ignorePercentage = .5; - if (req.body.ignorePercentage && typeof req.body.ignorePercentage === 'number' && req.body.ignorePercentage < 1 && req.body.ignorePercentage < 0) { + if (req.body.ignorePercentage && typeof req.body.ignorePercentage === 'number' && req.body.ignorePercentage < 1 && !req.body.ignorePercentage < 0) { ignorePercentage = req.body.ignorePercentage; } - // // Preference for recently played or not played recently - // // Preference for starred songs - let orClause; - if (req.user.vpaths.length === 1 && ignoreRating == false) { - orClause = { 'vpath': { '$eq': req.user.vpaths[0] } } - } else { - orClause = { '$or': [] } - for (let vpath of req.user.vpaths) { - orClause['$or'].push({ 'vpath': { '$eq': vpath } }) + let orClause = { '$or': [] }; + for (let vpath of req.user.vpaths) { + if (req.body.ignoreVPaths && typeof req.body.ignoreVPaths === 'object' && req.body.ignoreVPaths[vpath] === true) { + continue; } + orClause['$or'].push({ 'vpath': { '$eq': vpath } }); + } - if (ignoreRating) { - // Add Rating clause - } + let minRating = Number(req.body.minRating); + // Add Rating clause + if (minRating && typeof minRating === 'number' && minRating <= 10 && !minRating < 1) { + orClause = {'$and': [ + orClause, + { 'rating': { '$gte': req.body.minRating } } + ]}; } // Print list const results = fileCollection.find(orClause); const count = results.length; if (count === 0) { - res.status(444).json({ error: 'No songs that match criterai' }); + res.status(444).json({ error: 'No songs that match criteria' }); return; } @@ -532,7 +532,6 @@ exports.setup = function (mstream, program) { } }); - ignoreList.push(randomNumber); returnThis.ignoreList = ignoreList; res.json(returnThis); diff --git a/package.json b/package.json index 02ff50e..35484b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mstream", - "version": "4.5.4", + "version": "4.6.0", "description": "music streaming server", "main": "cli-boot-wrapper.js", "bin": { diff --git a/public/css/master.css b/public/css/master.css index 9fc5a51..6ddd0f4 100755 --- a/public/css/master.css +++ b/public/css/master.css @@ -140,9 +140,6 @@ p { .row, .inner-wrap, .off-canvas-wrap { height: 100%; } -div#jp_container_N { - right: 25px; } - .logo { width: 181px; height: auto; @@ -155,14 +152,6 @@ div#jp_container_N { position: relative; z-index: 3; } -.masterlist { - border: solid 1px #E0E0E0; - background: #FFF; - -webkit-box-shadow: 0 0 10px #D6D6D6; - -moz-box-shadow: 0 0 10px #D6D6D6; - box-shadow: 0 0 10px #D6D6D6; - padding: 10px; } - .filez, .dirz, .fileplaylistz, .back, .artistz, .albumz, .playlist_row_container, .playlist-item, #playlist_container ul li { font-family: Arial, Helvetica Neue, Helvetica, sans-serif; cursor: pointer; @@ -276,13 +265,6 @@ div#jp_container_N { width: calc(100% - 99px); } -#mplayer{ - margin-left: 0px !important; -} - -ul.jp-controls li { - list-style-type: none !important; } - #downform { display: none; position: absolute; } @@ -376,8 +358,6 @@ h3 { margin: 0; max-width: none; } - - @media (min-width: 644px) { .content { width: 50%; @@ -529,8 +509,6 @@ h3 { supported by Chrome and Opera */ } - - .meta-box{ width: 100%; height: 160px; @@ -550,7 +528,6 @@ h3 { height:5px; } - .meta-info{ height: 100%; width: calc(100% - 155px); @@ -844,3 +821,13 @@ ul.left-nav-menu li.selected svg { overflow-y: scroll; max-height: 300px; } + +input[name="autodj-folders"] { + cursor: pointer; +} + +#autodj-ratings{ + cursor: pointer; + margin-left: 10px; + max-width: calc(100% - 20px); +} \ No newline at end of file diff --git a/public/js/mstream.js b/public/js/mstream.js index b9babdf..900153e 100755 --- a/public/js/mstream.js +++ b/public/js/mstream.js @@ -1337,10 +1337,49 @@ $(document).ready(function () { currentBrowsingList = []; $('#directory_bar').hide(); - var newHtml = '
'; + var newHtml = 'Auto DJ randomly generates a playlist. CLick the \'DJ\' button on the bottom enable it
';
+ for (var i = 0; i < MSTREAMAPI.currentServer.vpaths.length; i++) {
+ var checkedString = '';
+ if (!MSTREAMPLAYER.ignoreVPaths[MSTREAMAPI.currentServer.vpaths[i]]) {
+ checkedString = 'checked';
+ }
+ newHtml += '
';
+ }
+
+ newHtml += '