kopia lustrzana https://github.com/OpenDroneMap/NodeODM
Fix max_images logic
rodzic
e4bfaf264b
commit
32ff066096
|
@ -163,7 +163,7 @@ module.exports = {
|
||||||
else cb(null, body);
|
else cb(null, body);
|
||||||
});
|
});
|
||||||
}catch(e){
|
}catch(e){
|
||||||
cb("Malformed body.json");
|
cb(new Error("Malformed body.json"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -244,10 +244,14 @@ module.exports = {
|
||||||
let destGcpPath = path.join(destPath, "gcp");
|
let destGcpPath = path.join(destPath, "gcp");
|
||||||
|
|
||||||
const checkMaxImageLimits = (cb) => {
|
const checkMaxImageLimits = (cb) => {
|
||||||
|
if (!config.maxImages) cb();
|
||||||
|
else{
|
||||||
fs.readdir(destImagesPath, (err, files) => {
|
fs.readdir(destImagesPath, (err, files) => {
|
||||||
if (config.maxImages && files.length > config.maxImages) cb(`${files.length} images uploaded, but this node can only process up to ${config.maxImages}.`);
|
if (err) cb(err);
|
||||||
else cb(err);
|
else if (files.length > config.maxImages) cb(new Error(`${files.length} images uploaded, but this node can only process up to ${config.maxImages}.`));
|
||||||
|
else cb();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
async.series([
|
async.series([
|
||||||
|
@ -319,11 +323,6 @@ module.exports = {
|
||||||
ziputils.unzip(seedFileDst, destPath, cb);
|
ziputils.unzip(seedFileDst, destPath, cb);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Verify max images limit
|
|
||||||
cb => {
|
|
||||||
checkMaxImageLimits(cb);
|
|
||||||
},
|
|
||||||
|
|
||||||
// Remove
|
// Remove
|
||||||
cb => {
|
cb => {
|
||||||
fs.exists(seedFileDst, exists => {
|
fs.exists(seedFileDst, exists => {
|
||||||
|
@ -335,20 +334,10 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleZipUrl = (cb) => {
|
const handleZipUrl = (cb) => {
|
||||||
async.series([
|
|
||||||
// Extract images
|
// Extract images
|
||||||
cb => {
|
|
||||||
ziputils.unzip(path.join(destImagesPath, "zipurl.zip"),
|
ziputils.unzip(path.join(destImagesPath, "zipurl.zip"),
|
||||||
destImagesPath,
|
destImagesPath,
|
||||||
cb,
|
cb, true);
|
||||||
true);
|
|
||||||
},
|
|
||||||
|
|
||||||
// Count files
|
|
||||||
cb => {
|
|
||||||
checkMaxImageLimits(cb);
|
|
||||||
}
|
|
||||||
], cb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find and handle zip files and extract
|
// Find and handle zip files and extract
|
||||||
|
@ -366,6 +355,11 @@ module.exports = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Verify max images limit
|
||||||
|
cb => {
|
||||||
|
checkMaxImageLimits(cb);
|
||||||
|
},
|
||||||
|
|
||||||
cb => {
|
cb => {
|
||||||
// Find any *.txt (GCP) file and move it to the data/<uuid>/gcp directory
|
// Find any *.txt (GCP) file and move it to the data/<uuid>/gcp directory
|
||||||
// also remove any lingering zipurl.zip
|
// also remove any lingering zipurl.zip
|
||||||
|
|
Ładowanie…
Reference in New Issue