fix error, remove stuff, add stuff
This commit is contained in:
7
.desktop
7
.desktop
@@ -1,7 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Type=Application
|
|
||||||
Name=Image & Video Upscaler
|
|
||||||
Comment=Upscale your videos and images with different upscalers
|
|
||||||
Path=/opt/imagevideoupscaler
|
|
||||||
Exec=/opt/imagevideoupscaler/imagevideoupscaler
|
|
||||||
Icon=imagevideoupscaler
|
|
||||||
21
frontend/src/app.js
Normal file
21
frontend/src/app.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
const express = require( 'express' );
|
||||||
|
let app = express();
|
||||||
|
const path = require( 'path' );
|
||||||
|
const fs = require( 'fs' );
|
||||||
|
const bodyParser = require( 'body-parser' );
|
||||||
|
const exec = require( 'child_process' ).exec;
|
||||||
|
|
||||||
|
app.use( bodyParser.urlencoded( { extended: false } ) );
|
||||||
|
app.use( bodyParser.json() );
|
||||||
|
|
||||||
|
function execute(command, callback){
|
||||||
|
exec(command, function(error, stdout, stderr){ callback(stdout); });
|
||||||
|
};
|
||||||
|
|
||||||
|
app.get( '/api/getEngines', ( request, response ) => {
|
||||||
|
execute( 'ImageVideoUpscaler-cli -p', out => {
|
||||||
|
response.send( out );
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
|
||||||
|
app.listen( 8081 );
|
||||||
@@ -3,63 +3,9 @@
|
|||||||
import { app, protocol, BrowserWindow } from 'electron';
|
import { app, protocol, BrowserWindow } from 'electron';
|
||||||
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib';
|
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib';
|
||||||
import installExtension, { VUEJS3_DEVTOOLS } from 'electron-devtools-installer';
|
import installExtension, { VUEJS3_DEVTOOLS } from 'electron-devtools-installer';
|
||||||
const electron = require( 'electron' );
|
|
||||||
const child_process = require( 'child_process' );
|
|
||||||
const dialog = electron.dialog;
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
|
require( './app.js' )
|
||||||
// Src for run_script function: https://stackoverflow.com/a/57058495
|
|
||||||
|
|
||||||
// This function will output the lines from the script
|
|
||||||
// and will return the full combined output
|
|
||||||
// as well as exit code when it's done (using the callback).
|
|
||||||
function run_script(command, args, callback) {
|
|
||||||
var child = child_process.spawn(command, args, {
|
|
||||||
encoding: 'utf8',
|
|
||||||
shell: true
|
|
||||||
});
|
|
||||||
// You can also use a variable to save the output for when the script closes later
|
|
||||||
child.on('error', (error) => {
|
|
||||||
dialog.showMessageBox({
|
|
||||||
title: 'Title',
|
|
||||||
type: 'warning',
|
|
||||||
message: 'Error occured.\r\n' + error
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
child.stdout.setEncoding('utf8');
|
|
||||||
child.stdout.on('data', (data) => {
|
|
||||||
//Here is the output
|
|
||||||
data=data.toString();
|
|
||||||
console.log(data);
|
|
||||||
});
|
|
||||||
|
|
||||||
child.stderr.setEncoding('utf8');
|
|
||||||
child.stderr.on('data', (data) => {
|
|
||||||
// Return some data to the renderer process with the mainprocess-response ID
|
|
||||||
mainWindow.webContents.send('mainprocess-response', data);
|
|
||||||
//Here is the output from the command
|
|
||||||
console.log(data);
|
|
||||||
});
|
|
||||||
|
|
||||||
child.on('close', (code) => {
|
|
||||||
//Here you can get the exit code of the script
|
|
||||||
switch (code) {
|
|
||||||
case 0:
|
|
||||||
dialog.showMessageBox({
|
|
||||||
title: 'Title',
|
|
||||||
type: 'info',
|
|
||||||
message: 'End process.\r\n'
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
if (typeof callback === 'function')
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Scheme must be registered before the app is ready
|
// Scheme must be registered before the app is ready
|
||||||
protocol.registerSchemesAsPrivileged([
|
protocol.registerSchemesAsPrivileged([
|
||||||
|
|||||||
@@ -6,12 +6,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import run_script from '@/background.js'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
run() {
|
run() {
|
||||||
run_script( 'ls' )
|
// run_script( 'ls' )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Type=Application
|
|
||||||
Name=FSR Image & Video Upscaler
|
|
||||||
Comment=Upscale your videos and images with FSR
|
|
||||||
Path=/opt/fsrimageupscaler
|
|
||||||
Exec=/opt/fsrimageupscaler/FSR\ Image\ \&\ Video\ Upscaler
|
|
||||||
Icon=fsrimageupscaler
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 43 KiB |
Reference in New Issue
Block a user