Skip to content

Commit 8ab3c36

Browse files
committed
Minor corrections
Removed 'console' calls, added {} and node status
1 parent 7488eaa commit 8ab3c36

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

  • services/visual_recognition

services/visual_recognition/v1.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ module.exports = function(RED) {
257257
};
258258

259259
this.on('input', function (msg) {
260-
console.log("Visual command: "+node.command);
261260
switch(this.command) {
262261
case "list":
263262
this.doList(msg);
@@ -298,7 +297,9 @@ module.exports = function(RED) {
298297

299298
var stream_buffer = function (file, contents, cb) {
300299
fs.writeFile(file, contents, function (err) {
301-
if (err) throw err;
300+
if (err) {
301+
throw err;
302+
}
302303
cb(fileType(contents).ext);
303304
});
304305
};
@@ -307,7 +308,9 @@ module.exports = function(RED) {
307308
var wstream = fs.createWriteStream(file);
308309
wstream.on('finish', function () {
309310
fs.readFile(file, function (err, buf) {
310-
if (err) console.error(err);
311+
if (err) {
312+
throw err;
313+
}
311314
cb(fileType(buf).ext);
312315
});
313316
});
@@ -318,12 +321,16 @@ module.exports = function(RED) {
318321
var stream_negative = (typeof msg.negative === 'string') ? stream_url : stream_buffer;
319322

320323
temp.open({suffix: '.zip'}, function (err, info) {
321-
if (err) throw err;
324+
if (err) {
325+
throw err;
326+
}
322327

323328
stream_positive(info.path, msg.positive, function (format) {
324329

325330
temp.open({suffix: '.zip'}, function (err2, info2) {
326-
if (err2) throw err2;
331+
if (err2) {
332+
throw err2;
333+
}
327334

328335
stream_negative(info2.path, msg.negative, function (format) {
329336

@@ -333,8 +340,10 @@ module.exports = function(RED) {
333340
negative_examples: fs.createReadStream(info2.path)
334341
};
335342

343+
node.status({fill:"blue", shape:"dot", text:"training"});
336344
visual_recognition.createClassifier(params,
337345
function(err, response) {
346+
node.status({});
338347
if (err) {
339348
node.error(err);
340349
} else {

0 commit comments

Comments
 (0)