Cleanup, license header, AdmZip replacement with Archiver

pull/1/head
Piero Toffanin 2016-07-18 17:56:27 -05:00
rodzic 23bdfe3103
commit 7b501e5dcd
12 zmienionych plików z 132 dodań i 26 usunięć

Wyświetl plik

@ -1,2 +0,0 @@
"use strict";

Wyświetl plik

@ -1,3 +0,0 @@
var odm = require("../index");
odm.hello();

Wyświetl plik

@ -1,3 +1,20 @@
/*
Node-OpenDroneMap Node.js App and REST API to access OpenDroneMap.
Copyright (C) 2016 Node-OpenDroneMap Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
"use strict";
let fs = require('fs');

Wyświetl plik

@ -1,9 +1,26 @@
/*
Node-OpenDroneMap Node.js App and REST API to access OpenDroneMap.
Copyright (C) 2016 Node-OpenDroneMap Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
"use strict";
let assert = require('assert');
let fs = require('fs');
let rmdir = require('rimraf');
let odmRunner = require('./odmRunner');
let AdmZip = require('adm-zip');
let archiver = require('archiver');
let statusCodes = require('./statusCodes');
@ -138,22 +155,34 @@ module.exports = class Task{
// Starts processing the task with OpenDroneMap
// This will spawn a new process.
start(done){
function postProcess(done){
let zip = new AdmZip();
zip.addLocalFolder(`${this.getProjectFolderPath()}/odm_orthophoto`);
zip.addLocalFolder(`${this.getProjectFolderPath()}/odm_georeferencing`);
zip.addLocalFolder(`${this.getProjectFolderPath()}/odm_texturing`);
zip.addLocalFolder(`${this.getProjectFolderPath()}/odm_meshing`);
zip.writeZip(this.getAssetsArchivePath());
const postProcess = () => {
let output = fs.createWriteStream(this.getAssetsArchivePath());
let archive = archiver.create('zip', {});
this.setStatus(statusCodes.COMPLETED);
finished();
}
archive.on('finish', () => {
// TODO: is this being fired twice?
this.setStatus(statusCodes.COMPLETED);
finished();
});
function finished(){
archive.on('error', err => {
this.setStatus(statusCodes.FAILED);
finished(err);
});
archive.pipe(output);
archive
.directory(`${this.getProjectFolderPath()}/odm_orthophoto`, 'odm_orthophoto')
.directory(`${this.getProjectFolderPath()}/odm_georeferencing`, 'odm_georeferencing')
.directory(`${this.getProjectFolderPath()}/odm_texturing`, 'odm_texturing')
.directory(`${this.getProjectFolderPath()}/odm_meshing`, 'odm_meshing')
.finalize();
};
const finished = err => {
this.stopTrackingProcessingTime();
done();
}
done(err);
};
if (this.status.code === statusCodes.QUEUED){
this.startTrackingProcessingTime();
@ -168,7 +197,7 @@ module.exports = class Task{
// Don't evaluate if we caused the process to exit via SIGINT?
if (this.status.code !== statusCodes.CANCELED){
if (code === 0){
postProcess(done);
postProcess();
}else{
this.setStatus(statusCodes.FAILED, {errorMessage: `Process exited with code ${code}`});
finished();

Wyświetl plik

@ -1,3 +1,20 @@
/*
Node-OpenDroneMap Node.js App and REST API to access OpenDroneMap.
Copyright (C) 2016 Node-OpenDroneMap Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
"use strict";
let assert = require('assert');
let fs = require('fs');

Wyświetl plik

@ -1,3 +1,20 @@
/*
Node-OpenDroneMap Node.js App and REST API to access OpenDroneMap.
Copyright (C) 2016 Node-OpenDroneMap Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
"use strict";
let spawn = require('child_process').spawn;

Wyświetl plik

@ -1,3 +1,20 @@
/*
Node-OpenDroneMap Node.js App and REST API to access OpenDroneMap.
Copyright (C) 2016 Node-OpenDroneMap Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
"use strict";
module.exports = {
QUEUED: 10,

Wyświetl plik

@ -20,7 +20,7 @@
},
"homepage": "https://github.com/pierotofy/node-OpenDroneMap#readme",
"dependencies": {
"adm-zip": "^0.4.7",
"archiver": "^1.0.0",
"async": "^2.0.0-rc.6",
"body-parser": "^1.15.2",
"express": "^4.14.0",

Wyświetl plik

@ -48,7 +48,7 @@
<div id="errorBlock" class="help-block"></div>
</div>
<div class="form-group">
<label>Options:</label>
<!-- <label>Options:</label> -->
</div>
<div class="text-right"><input type="submit" class="btn btn-success" value="Start Task" id="btnUpload" /></div>

Wyświetl plik

@ -1,3 +1,20 @@
/*
Node-OpenDroneMap Node.js App and REST API to access OpenDroneMap.
Copyright (C) 2016 Node-OpenDroneMap Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
$(function(){
function hoursMinutesSecs(t){
var ch = 60 * 60 * 1000,
@ -7,7 +24,7 @@ $(function(){
s = Math.round( (t - h * ch - m * cm) / 1000),
pad = function(n){ return n < 10 ? '0' + n : n; };
if( s === 60 ){
h++;
m++;
s = 0;
}
if( m === 60 ){

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 72 KiB

Wyświetl plik

@ -1,3 +0,0 @@
exports.hello = () => {
console.log("Hi");
}