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,
"profiles": {
"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.
**/
const path_1 = require("path");
const url_1 = require("url");
const delay_1 = require("delay");
const { BrowserWindow } = require('electron');
class WebView {
@ -23,12 +24,17 @@ class WebView {
minHeight: 600 //,
//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) {
prefs.x = display.x + 50;
prefs.y = display.y + 50;
}
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) {
this.digitalWindow.webContents.openDevTools();
}
@ -53,12 +59,13 @@ class WebView {
}
}
async show(src) {
const normalSrc = path_1.normalize(path_1.join(src));
if (!this.digitalWindow) {
console.warn(`Cannot show "${src}" because window does not exist`);
return false;
}
try {
this.digitalWindow.webContents.send('display', { src });
this.digitalWindow.webContents.send('display', { src: normalSrc });
}
catch (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);
}
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) {
rgb = rgb.map((e) => {
return parseInt(e);

File diff suppressed because one or more lines are too long

View File

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

View File

@ -1,5 +1,5 @@
{
"version": "1.6.2",
"version": "1.6.3",
"ext_port": 1111,
"profiles": {
"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.
**/
const path_1 = require("path");
const url_1 = require("url");
const delay_1 = require("delay");
const { BrowserWindow } = require('electron');
class WebView {
@ -23,12 +24,17 @@ class WebView {
minHeight: 600 //,
//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) {
prefs.x = display.x + 50;
prefs.y = display.y + 50;
}
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) {
this.digitalWindow.webContents.openDevTools();
}
@ -53,12 +59,13 @@ class WebView {
}
}
async show(src) {
const normalSrc = path_1.normalize(path_1.join(src));
if (!this.digitalWindow) {
console.warn(`Cannot show "${src}" because window does not exist`);
return false;
}
try {
this.digitalWindow.webContents.send('display', { src });
this.digitalWindow.webContents.send('display', { src: normalSrc });
}
catch (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);
}
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) {
rgb = rgb.map((e) => {
return parseInt(e);

File diff suppressed because one or more lines are too long

View File

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

View File

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

2
package-lock.json generated
View File

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

View File

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

View File

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

View File

@ -5,7 +5,8 @@
* 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';
const { BrowserWindow } = require('electron');
@ -31,12 +32,17 @@ class WebView {
minHeight : 600//,
//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) {
prefs.x = display.x + 50;
prefs.y = display.y + 50;
}
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) {
this.digitalWindow.webContents.openDevTools();
}
@ -63,12 +69,13 @@ class WebView {
}
}
async show (src : string) {
const normalSrc : string = pathNormalize(pathJoin(src));
if (!this.digitalWindow) {
console.warn(`Cannot show "${src}" because window does not exist`);
return false;
}
try {
this.digitalWindow.webContents.send('display', { src });
this.digitalWindow.webContents.send('display', { src : normalSrc });
} catch (err) {
console.error(err);
}

View File

@ -184,7 +184,7 @@ class FFMPEG {
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 ) {
rgb = rgb.map((e : string) => {