diff --git a/jukebox/child-process.js b/jukebox/child-process.js index b36854e..873ae9c 100644 --- a/jukebox/child-process.js +++ b/jukebox/child-process.js @@ -18,11 +18,11 @@ module.exports.ChildProcessEmitter = class ChildProcessEmitter extends EventEmit this.childProcess = spawn(cmd, args); this.childProcess.on('error', function(err) { - logger.error("process error", { name: name, err: err }); + this.logger.error("process error", { class: this.constructor.name, name: name, err: String(err).trim() }); }); this.childProcess.on('close', function(code, signal) { - logger.debug("process closed", { name: name, code: code, signal: signal }); + this.logger.debug("process closed", { class: this.constructor.name, name: name, code: code, signal: signal }); }); this.childProcess.stdout.on('data', (data) => { @@ -33,7 +33,7 @@ module.exports.ChildProcessEmitter = class ChildProcessEmitter extends EventEmit }); this.childProcess.stderr.on('data', (data) => { - this.emit('message', lines[i]); + this.logger.error('process stderr', { class: this.constructor.name, stderr: String(data).trim()}); }); } diff --git a/jukebox/media-player.js b/jukebox/media-player.js index dba1277..7703b53 100644 --- a/jukebox/media-player.js +++ b/jukebox/media-player.js @@ -4,7 +4,7 @@ const ChildProcessEmitter = require('./child-process').ChildProcessEmitter; class MediaPlayer extends ChildProcessEmitter { constructor(config, logger) { - super(config.mpg321); + super(config.mpg321, logger); } } diff --git a/jukebox/tag-reader.js b/jukebox/tag-reader.js index 47e5d9e..fc168cb 100644 --- a/jukebox/tag-reader.js +++ b/jukebox/tag-reader.js @@ -4,7 +4,7 @@ const ChildProcessEmitter = require('./child-process').ChildProcessEmitter; class TagReader extends ChildProcessEmitter { constructor(config, logger) { - super(config.tag_reader); + super(config.tag_reader, logger); } } diff --git a/player.js b/player.js index 6ed45d8..ba9fd18 100644 --- a/player.js +++ b/player.js @@ -66,6 +66,8 @@ function lookup(tag, cb) { return cb('PAUSE', 2); } + return cb('PLAY foo'); + glob('media/' + tag + ' - *.mp3', function(er, files) { if (files.length > 0) { appendLog(files[0]);