Normalize paths being used in filmout feature. Purpose of this is to rely on fs module to correctly handle paths for windows because it was previously broken. Will run tests.

This commit is contained in:
sixteenmillimeter 2020-07-26 22:26:34 -04:00
parent 0c364576c9
commit 0811222d27
18 changed files with 43 additions and 22 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "1.6.2", "version": "1.6.3",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {

View File

@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
* Provides features for displaying a full screen display of images for the digital module. * Provides features for displaying a full screen display of images for the digital module.
**/ **/
const path_1 = require("path"); const path_1 = require("path");
const url_1 = require("url");
const delay_1 = require("delay"); const delay_1 = require("delay");
const { BrowserWindow } = require('electron'); const { BrowserWindow } = require('electron');
class WebView { class WebView {
@ -23,12 +24,17 @@ class WebView {
minHeight: 600 //, minHeight: 600 //,
//icon: path.join(__dirname, '../../assets/icons/icon.png') //icon: path.join(__dirname, '../../assets/icons/icon.png')
}; };
const pagePath = path_1.normalize(path_1.join(__dirname, '../../display.html'));
const pageUrl = url_1.format({
pathname: pagePath,
protocol: 'file:'
});
if (!display.primary) { if (!display.primary) {
prefs.x = display.x + 50; prefs.x = display.x + 50;
prefs.y = display.y + 50; prefs.y = display.y + 50;
} }
this.digitalWindow = new BrowserWindow(prefs); this.digitalWindow = new BrowserWindow(prefs);
this.digitalWindow.loadURL('file://' + __dirname + '../../../display.html'); this.digitalWindow.loadURL(pageUrl);
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) { if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
this.digitalWindow.webContents.openDevTools(); this.digitalWindow.webContents.openDevTools();
} }
@ -53,12 +59,13 @@ class WebView {
} }
} }
async show(src) { async show(src) {
const normalSrc = path_1.normalize(path_1.join(src));
if (!this.digitalWindow) { if (!this.digitalWindow) {
console.warn(`Cannot show "${src}" because window does not exist`); console.warn(`Cannot show "${src}" because window does not exist`);
return false; return false;
} }
try { try {
this.digitalWindow.webContents.send('display', { src }); this.digitalWindow.webContents.send('display', { src: normalSrc });
} }
catch (err) { catch (err) {
console.error(err); console.error(err);

File diff suppressed because one or more lines are too long

View File

@ -146,7 +146,7 @@ class FFMPEG {
this.log.error(err); this.log.error(err);
} }
if (output && output.stdout) if (output && output.stdout)
this.log.info(`"${output.stdout}"`); this.log.info(`"${output.stdout.trim()}"`);
if (rgb[0] !== 255 || rgb[1] !== 255 || rgb[2] !== 255) { if (rgb[0] !== 255 || rgb[1] !== 255 || rgb[2] !== 255) {
rgb = rgb.map((e) => { rgb = rgb.map((e) => {
return parseInt(e); return parseInt(e);

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy-app", "name": "mcopy-app",
"version": "1.6.2", "version": "1.6.3",
"description": "GUI for the mcopy small gauge film optical printer platform", "description": "GUI for the mcopy small gauge film optical printer platform",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {

View File

@ -1,5 +1,5 @@
{ {
"version": "1.6.2", "version": "1.6.3",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {

View File

@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
* Provides features for displaying a full screen display of images for the digital module. * Provides features for displaying a full screen display of images for the digital module.
**/ **/
const path_1 = require("path"); const path_1 = require("path");
const url_1 = require("url");
const delay_1 = require("delay"); const delay_1 = require("delay");
const { BrowserWindow } = require('electron'); const { BrowserWindow } = require('electron');
class WebView { class WebView {
@ -23,12 +24,17 @@ class WebView {
minHeight: 600 //, minHeight: 600 //,
//icon: path.join(__dirname, '../../assets/icons/icon.png') //icon: path.join(__dirname, '../../assets/icons/icon.png')
}; };
const pagePath = path_1.normalize(path_1.join(__dirname, '../../display.html'));
const pageUrl = url_1.format({
pathname: pagePath,
protocol: 'file:'
});
if (!display.primary) { if (!display.primary) {
prefs.x = display.x + 50; prefs.x = display.x + 50;
prefs.y = display.y + 50; prefs.y = display.y + 50;
} }
this.digitalWindow = new BrowserWindow(prefs); this.digitalWindow = new BrowserWindow(prefs);
this.digitalWindow.loadURL('file://' + __dirname + '../../../display.html'); this.digitalWindow.loadURL(pageUrl);
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) { if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
this.digitalWindow.webContents.openDevTools(); this.digitalWindow.webContents.openDevTools();
} }
@ -53,12 +59,13 @@ class WebView {
} }
} }
async show(src) { async show(src) {
const normalSrc = path_1.normalize(path_1.join(src));
if (!this.digitalWindow) { if (!this.digitalWindow) {
console.warn(`Cannot show "${src}" because window does not exist`); console.warn(`Cannot show "${src}" because window does not exist`);
return false; return false;
} }
try { try {
this.digitalWindow.webContents.send('display', { src }); this.digitalWindow.webContents.send('display', { src: normalSrc });
} }
catch (err) { catch (err) {
console.error(err); console.error(err);

File diff suppressed because one or more lines are too long

View File

@ -146,7 +146,7 @@ class FFMPEG {
this.log.error(err); this.log.error(err);
} }
if (output && output.stdout) if (output && output.stdout)
this.log.info(`"${output.stdout}"`); this.log.info(`"${output.stdout.trim()}"`);
if (rgb[0] !== 255 || rgb[1] !== 255 || rgb[2] !== 255) { if (rgb[0] !== 255 || rgb[1] !== 255 || rgb[2] !== 255) {
rgb = rgb.map((e) => { rgb = rgb.map((e) => {
return parseInt(e); return parseInt(e);

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy-cli", "name": "mcopy-cli",
"version": "1.6.2", "version": "1.6.3",
"description": "CLI for controlling the mcopy optical printer platform", "description": "CLI for controlling the mcopy optical printer platform",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -1,5 +1,5 @@
{ {
"version": "1.6.2", "version": "1.6.3",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy", "name": "mcopy",
"version": "1.6.2", "version": "1.6.3",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy", "name": "mcopy",
"version": "1.6.2", "version": "1.6.3",
"description": "Small gauge film optical printer platform", "description": "Small gauge film optical printer platform",
"main": "build.js", "main": "build.js",
"directories": { "directories": {

View File

@ -1,5 +1,5 @@
{ {
"version": "1.6.2", "version": "1.6.3",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {

View File

@ -5,7 +5,8 @@
* Provides features for displaying a full screen display of images for the digital module. * Provides features for displaying a full screen display of images for the digital module.
**/ **/
import { join as pathJoin } from 'path'; import { join as pathJoin, normalize as pathNormalize } from 'path';
import { format as urlFormat } from 'url';
import { delay } from 'delay'; import { delay } from 'delay';
const { BrowserWindow } = require('electron'); const { BrowserWindow } = require('electron');
@ -31,12 +32,17 @@ class WebView {
minHeight : 600//, minHeight : 600//,
//icon: path.join(__dirname, '../../assets/icons/icon.png') //icon: path.join(__dirname, '../../assets/icons/icon.png')
} }
const pagePath : string = pathNormalize(pathJoin(__dirname, '../../display.html'))
const pageUrl : string = urlFormat({
pathname : pagePath,
protocol : 'file:'
});
if (!display.primary) { if (!display.primary) {
prefs.x = display.x + 50; prefs.x = display.x + 50;
prefs.y = display.y + 50; prefs.y = display.y + 50;
} }
this.digitalWindow = new BrowserWindow(prefs); this.digitalWindow = new BrowserWindow(prefs);
this.digitalWindow.loadURL('file://' + __dirname + '../../../display.html'); this.digitalWindow.loadURL(pageUrl);
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) { if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
this.digitalWindow.webContents.openDevTools(); this.digitalWindow.webContents.openDevTools();
} }
@ -63,12 +69,13 @@ class WebView {
} }
} }
async show (src : string) { async show (src : string) {
const normalSrc : string = pathNormalize(pathJoin(src));
if (!this.digitalWindow) { if (!this.digitalWindow) {
console.warn(`Cannot show "${src}" because window does not exist`); console.warn(`Cannot show "${src}" because window does not exist`);
return false; return false;
} }
try { try {
this.digitalWindow.webContents.send('display', { src }); this.digitalWindow.webContents.send('display', { src : normalSrc });
} catch (err) { } catch (err) {
console.error(err); console.error(err);
} }

View File

@ -184,7 +184,7 @@ class FFMPEG {
this.log.error(err); this.log.error(err);
} }
if (output && output.stdout) this.log.info(`"${output.stdout}"`); if (output && output.stdout) this.log.info(`"${output.stdout.trim()}"`);
if ( rgb[0] !== 255 || rgb[1] !== 255 || rgb[2] !== 255 ) { if ( rgb[0] !== 255 || rgb[1] !== 255 || rgb[2] !== 255 ) {
rgb = rgb.map((e : string) => { rgb = rgb.map((e : string) => {