New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ocrservice

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ocrservice - npm Package Compare versions

Comparing version 0.1.55 to 0.1.56

3

lib/classes/cwatcherclient.js

@@ -27,4 +27,5 @@ (function() {

this.processlist = processlist;
console.log(this.pathname, this.filename);
if (typeof this.processlist === 'undefined') {
console.log('CWatcherClient', 'there was no processlist given !');
console.log('CWatcherClient', 'there was no processlist given!');
}

@@ -31,0 +32,0 @@ this.setBadPath(path.join(this.pathname, 'bad'));

(function() {
var CWatchCommand, CWatcherClient, CWatcherMaster, Command, cluster, glob, path, variables,
var CWatchCommand, CWatcherMaster, Command, DB, Recognizer, cluster, fs, glob, path, variables,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },

@@ -16,6 +16,10 @@ hasProp = {}.hasOwnProperty;

fs = require('fs');
CWatcherMaster = require('../classes/cwatchermaster');
CWatcherClient = require('../classes/cwatcherclient');
DB = require('../classes/db');
Recognizer = require('../classes/recognizer');
module.exports = CWatchCommand = (function(superClass) {

@@ -76,3 +80,4 @@ extend(CWatchCommand, superClass);

return process.on('message', function(msg) {
var cclient, e, processlist;
var db, e, filename, pathname, processlist, recognizer;
db = new DB(variables.OCR_DB_NAME, variables.OCR_DB_USER, variables.OCR_DB_PASSWORD, variables.OCR_DB_HOST);
try {

@@ -83,24 +88,87 @@ processlist = require(program.processlist);

}
console.log('worker', msg, options.pathname);
console.log('worker', processlist);
cclient = new CWatcherClient(cluster, options.pathname, msg, processlist);
if (options.noaddress) {
cclient.setNoAddressPath(options.noaddress);
}
if (options.good) {
cclient.setGoodPath(options.good);
}
if (options.nocode) {
cclient.setNoCodePath(options.nocode);
}
if (options.bad) {
cclient.setBadPath(options.bad);
}
cclient.on('error', function(err) {
return console.error(err);
console.log(msg);
console.time("elapsed");
filename = path.join(options.pathname, msg);
pathname = options.pathname;
recognizer = new Recognizer(db, processlist);
recognizer.setDebug(program.debug || false);
recognizer.on('error', function(err) {
throw err;
});
return cclient.on('stoped', function(err) {
cclient.db.stop();
return process.exit();
recognizer.on('open', function(res) {
return recognizer.test();
});
recognizer.on('boxes', function(res, codes) {
var bad, box, goodPath, item, name, noAddressPath, noCodePath, nocode, ref;
console.log(JSON.stringify(res, null, 1), codes);
console.timeEnd("elapsed");
name = codes.join('.');
bad = path.join(pathname, 'good');
goodPath = path.join(pathname, 'good');
noAddressPath = path.join(pathname, 'noaddress');
noCodePath = path.join(pathname, 'nocode');
if (options.noaddress) {
noAddressPath = options.noaddress;
}
if (options.good) {
goodPath = options.good;
}
if (options.nocode) {
nocode = options.nocode;
}
if (options.bad) {
bad = options.bad;
}
if (res.length > 0 && codes.length > 0 && ((ref = res[0].box) != null ? ref.length : void 0) > 0) {
fs.rename(filename, path.join(goodPath, name + path.extname(filename)), function(err) {
return process.exit();
});
process.send(res[0]);
} else if (codes.length > 0) {
box = {
sortiergang: 'NA',
sortierfach: 'NA',
strid: -1,
mandant: null,
regiogruppe: null,
bereich: 'NA',
plz: '',
ort: '',
ortsteil: '',
hnvon: '',
hnbis: '',
gerade: '',
ungerade: '',
strasse: ''
};
item = {
name: "",
street: "",
housenumber: "",
housenumberExtension: "",
flatNumber: "",
zipCode: "",
town: "",
state: true,
message: "",
box: [box],
codes: codes,
ocr_street: '',
ocr_zipCode: '',
ocr_town: '',
district: ''
};
process.send(item);
fs.rename(filename, path.join(noAddressPath, name + path.extname(filename)), function(err) {
return process.exit();
});
} else if (codes.length === 0) {
name = (new Date()).getTime();
fs.rename(file, path.join(code, name + path.extname(filename)), function(err) {
return process.exit();
});
}
return db.connection.end();
});
return recognizer.open(filename, true);
});

@@ -107,0 +175,0 @@ }

@@ -14,3 +14,3 @@ {

},
"version": "0.1.55",
"version": "0.1.56",
"engines": {

@@ -17,0 +17,0 @@ "node": ">=0.12.0"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc