Album art fixes

This commit is contained in:
IrosTheBeggar 2017-04-29 01:36:24 -04:00
parent f35f21ca57
commit 39000e5499
3 changed files with 12 additions and 7 deletions

View File

@ -1,11 +1,12 @@
exports.setup = function(args){
const program = require('commander');
program
.version('2.6.0')
.version('3.0.1')
// Server Config
.option('-p, --port <port>', 'Select Port', /^\d+$/i, 3000)
.option('-i, --userinterface <folder>', 'Specify folder name that will be served as the UI', 'public')
.option('-s, --secret <secret>', 'Set the login secret key')
.option('-I, --images <images>', 'Set the image folder')
// SSL
.option('-c, --cert <cert>', 'SSL Certificate File')
@ -101,6 +102,10 @@ exports.setup = function(args){
program3.ssl.cert = program.cert;
}
// images
if(program.images){
program3.albumArtDir = program.images;
}
return program3;
}

View File

@ -183,7 +183,7 @@ function parseFile(thisSong){
var picHashString = crypto.createHash('sha256').update(bufferString).digest('hex');
songInfo.albumArtFilename = picHashString + '.' + picFormat;
// Cehck image-cache folder for filename and save if doesn't exist
if (!fs.existsSync(songInfo.albumArtFilename)) {
if (!fs.existsSync(fe.join(loadJson.albumArtDir, songInfo.albumArtFilename))) {
// Save file sync
fs.writeFileSync(fe.join(loadJson.albumArtDir, songInfo.albumArtFilename), songInfo.picture[0].data);
}

View File

@ -64,13 +64,13 @@ exports.serveit = function (program, callback) {
});
}
// Setup Album Art
// TODO: Move to after login systm ???
mstream.use( '/album-art', express.static(fe.join(__dirname, 'image-cache') ));
program.albumArtDir = fe.join(__dirname, 'image-cache');
if(!program.albumArtDir){
program.albumArtDir = fe.join(__dirname, 'image-cache');
}
// Move to after login systm
mstream.use( '/album-art', express.static(program.albumArtDir ));
// TODO: Move this to the configure module
// Setup Secret for JWT
try{
// IF user entered a filepath