delete image file after identified
This commit is contained in:
@@ -3,6 +3,7 @@ const {exec} = require("child_process");
|
||||
|
||||
const axios = require("axios");
|
||||
const {v4: uuidv4} = require('uuid');
|
||||
const OCRResult = require("../models/OCRResult");
|
||||
|
||||
// const DEEPLEARNING_CAPTCHA_HOST = "http://appointment.lpaconsulting.fr:9000"
|
||||
const DEEPLEARNING_CAPTCHA_HOST = "http://192.168.0.36:9000"
|
||||
@@ -67,6 +68,7 @@ class SlidingCaptchaSolver {
|
||||
console.log("will slide captcha");
|
||||
await exec(cmd);
|
||||
await delay(5000);
|
||||
await this.deleteFile(blockedImageFileName)
|
||||
onResult(true)
|
||||
} else {
|
||||
console.log("startPosition not found for " + device.model())
|
||||
@@ -79,7 +81,14 @@ class SlidingCaptchaSolver {
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
async deleteFile(filename) {
|
||||
try {
|
||||
fs.unlinkSync(filename)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return OCRResult.TERMINAED
|
||||
}
|
||||
}
|
||||
async sendRequest(fileName, callback) {
|
||||
const fileStream = fs.createReadStream(fileName);
|
||||
let response = await axios.post(DEEPLEARNING_CAPTCHA_HOST, fileStream, {
|
||||
|
||||
Reference in New Issue
Block a user