kopia lustrzana https://github.com/OpenBuilds/OpenBuilds-CONTROL
Remove gcodethumb as canvas fails on Travis
rodzic
c1fc6a459d
commit
2c1dd1f793
56
index.js
56
index.js
|
@ -53,7 +53,7 @@ var rimraf = require("rimraf")
|
||||||
var formidable = require('formidable')
|
var formidable = require('formidable')
|
||||||
var util = require('util');
|
var util = require('util');
|
||||||
var lastsentuploadprogress = 0;
|
var lastsentuploadprogress = 0;
|
||||||
var gcodethumbnail = require("gcodethumbnail");
|
// var gcodethumbnail = require("gcodethumbnail");
|
||||||
var colors = {
|
var colors = {
|
||||||
G0: '#00CC00',
|
G0: '#00CC00',
|
||||||
G1: '#CC0000',
|
G1: '#CC0000',
|
||||||
|
@ -387,36 +387,36 @@ var status = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function refreshGcodeLibrary() {
|
function refreshGcodeLibrary() {
|
||||||
if (fs.existsSync(uploadsDir)) {
|
// if (fs.existsSync(uploadsDir)) {
|
||||||
const dirTree = require('directory-tree');
|
// const dirTree = require('directory-tree');
|
||||||
|
//
|
||||||
var tree = dirTree(uploadsDir, {
|
// var tree = dirTree(uploadsDir, {
|
||||||
extensions: /\.gcode|\.nc|\.tap|\.cnc|\.gc|\.g-code$/
|
// extensions: /\.gcode|\.nc|\.tap|\.cnc|\.gc|\.g-code$/
|
||||||
}, (item, PATH) => {
|
// }, (item, PATH) => {
|
||||||
// if a gcode is found, then
|
// // if a gcode is found, then
|
||||||
// console.log(item);
|
// // console.log(item);
|
||||||
ConvertGCODEtoPNG(item.path, item.path + ".png")
|
// ConvertGCODEtoPNG(item.path, item.path + ".png")
|
||||||
});
|
// });
|
||||||
// console.log("---------------")
|
// // console.log("---------------")
|
||||||
var tree = dirTree(uploadsDir, {
|
// var tree = dirTree(uploadsDir, {
|
||||||
extensions: /\.gcode|\.png/
|
// extensions: /\.gcode|\.png/
|
||||||
});
|
// });
|
||||||
var treeData = JSON.stringify(tree, null, 2)
|
// var treeData = JSON.stringify(tree, null, 2)
|
||||||
// console.log(treeData);
|
// // console.log(treeData);
|
||||||
fs.writeFileSync(join(uploadsDir + '/data.json'), treeData, 'utf-8')
|
// fs.writeFileSync(join(uploadsDir + '/data.json'), treeData, 'utf-8')
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
function ConvertGCODEtoPNG(file, out) {
|
function ConvertGCODEtoPNG(file, out) {
|
||||||
var path = out;
|
// var path = out;
|
||||||
fs.readFile(file, 'utf8',
|
// fs.readFile(file, 'utf8',
|
||||||
function(err, data) {
|
// function(err, data) {
|
||||||
if (err) {
|
// if (err) {
|
||||||
console.log(err);
|
// console.log(err);
|
||||||
process.exit(1);
|
// process.exit(1);
|
||||||
}
|
// }
|
||||||
gcodethumbnail.generatePNG(path, data, colors, width, height);
|
// gcodethumbnail.generatePNG(path, data, colors, width, height);
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
SerialPort.list(function(err, ports) {
|
SerialPort.list(function(err, ports) {
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
"electron-updater": "^2.23.3",
|
"electron-updater": "^2.23.3",
|
||||||
"express": "^4.16.2",
|
"express": "^4.16.2",
|
||||||
"formidable": "^1.2.1",
|
"formidable": "^1.2.1",
|
||||||
"gcodethumbnail": "^1.0.1",
|
|
||||||
"ip": "^1.1.5",
|
"ip": "^1.1.5",
|
||||||
"lodash": "^4.17.10",
|
"lodash": "^4.17.10",
|
||||||
"md5": "^2.2.1",
|
"md5": "^2.2.1",
|
||||||
|
|
Ładowanie…
Reference in New Issue