fix lots of GUI bugs + styling a lil
This commit is contained in:
Binary file not shown.
@@ -23,6 +23,7 @@ class Scaler:
|
||||
|
||||
os.system( self.command )
|
||||
print( '\n\n==>Photo upscaled' );
|
||||
return True;
|
||||
|
||||
def videoScaler ( self, tmppath, threads, scalefactor, sharpening, filetype, mode ):
|
||||
modes = { 'av3':'realesr-animevideov3', 'x4plus': 'realesrgan-x4plus-anime' }
|
||||
|
||||
@@ -86,10 +86,10 @@ class Handler:
|
||||
# Determining filetype
|
||||
if str(filepath)[len(filepath) - 4:] == '.mp4' or str(filepath)[len(filepath) - 4:] == '.mkv' or str(filepath)[len(filepath) - 4:] == '.MP4':
|
||||
print( '\n\n==> Upscaling video' )
|
||||
self.video_scaling( filepath, output_path, scalefactor, threads, sharpening, filetype, mode, engine )
|
||||
return self.video_scaling( filepath, output_path, scalefactor, threads, sharpening, filetype, mode, engine )
|
||||
elif str(filepath)[len(filepath) - 4:] == '.JPG' or str(filepath)[len(filepath) - 4:] == '.png' or str(filepath)[len(filepath) - 4:] == '.jpg' or str(filepath)[len(filepath) - 5:] == '.jpeg':
|
||||
print( '\n==> Upscaling Image' )
|
||||
self.photo_scaling( filepath, output_path, scalefactor, sharpening, threads, engine, mode )
|
||||
return self.photo_scaling( filepath, output_path, scalefactor, sharpening, threads, engine, mode )
|
||||
else:
|
||||
print('not supported')
|
||||
return False
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<nav>
|
||||
<router-link to="/">Home</router-link> |
|
||||
<router-link to="/about">About</router-link> |
|
||||
<router-link to="/settings">Settings</router-link>
|
||||
<router-link to="/about">About</router-link>
|
||||
<!-- |
|
||||
<router-link to="/settings">Settings</router-link> -->
|
||||
</nav>
|
||||
<router-view v-slot="{ Component, route }">
|
||||
<transition :name="route.meta.transition || 'scale'" mode="out-in">
|
||||
|
||||
BIN
frontend/src/assets/logo.png
Normal file → Executable file
BIN
frontend/src/assets/logo.png
Normal file → Executable file
Binary file not shown.
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 592 KiB |
@@ -32,16 +32,26 @@ class UpscalingHandler {
|
||||
|
||||
let args = []
|
||||
args.push( '-i' + options.InputFile );
|
||||
args.push( '-o ' + options.OutputFile );
|
||||
args.push( '-o' + options.OutputFile );
|
||||
|
||||
args.push( '-s ' + options.scale )
|
||||
if ( options.scale != 0 ) {
|
||||
args.push( '-s' + options.scale );
|
||||
}
|
||||
|
||||
if ( options.sharpening != 0 ) {
|
||||
args.push( '-S' + options.sharpening );
|
||||
}
|
||||
|
||||
args.push( '-M' + options.algorithm );
|
||||
args.push( '-E' + options.engine );
|
||||
// add additional options
|
||||
// baseCommand += + ' -S ' + options.sharpening
|
||||
// baseCommand += ' -E ' + options.engine + ' -M ' + options.algorithm
|
||||
|
||||
console.log( 'upscaling' );
|
||||
|
||||
console.log( args );
|
||||
|
||||
let child = child_process.spawn( baseCommand, args );
|
||||
|
||||
child.stdout.on( 'data', data => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="about">
|
||||
<img src="@/assets/logo.png">
|
||||
<img src="@/assets/logo.png" style="height: 30vh;">
|
||||
<h1>About SimpleMediaUpscalerLite</h1>
|
||||
<p>SimpleMediaUpscalerLite is an application that allows you to upscale your videos and / or images. It uses an Electron GUI (Graphical User Interface) and a Python CLI (Command Line Interface).</p>
|
||||
<div class="version-info">
|
||||
|
||||
@@ -34,9 +34,21 @@
|
||||
<tr id="group3" class="group">
|
||||
<td>
|
||||
<button @click="runCommand( 'InputFile' )">Input file</button><br>
|
||||
<div v-if="upscaleSettings.InputFile[ 0 ]" id="inputCheck" @mouseenter="showElement( 'inputfile' )" @mouseleave="hideElement( 'inputfile' )">✔</div>
|
||||
<div class="info-container">
|
||||
<div class="info" id="inputfile">
|
||||
{{ upscaleSettings.InputFile[ 0 ] }}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<button @click="runCommand( 'OutputFile' )">Output file</button><br>
|
||||
<div v-if="upscaleSettings.OutputFile" id="outputCheck" @mouseenter="showElement( 'outputfile' )" @mouseleave="hideElement( 'outputfile' )">✔</div>
|
||||
<div class="info-container">
|
||||
<div class="info" id="outputfile">
|
||||
{{ upscaleSettings.OutputFile }}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -176,12 +188,35 @@ export default {
|
||||
let fileExtension = this.upscaleSettings.InputFile[ 0 ].substring( this.upscaleSettings.InputFile[ 0 ].length - 4 );
|
||||
this.upscaleSettings.OutputFile = this.upscaleSettings.OutputFile.slice( 0, this.upscaleSettings.OutputFile[ 0 ].length - 5 ) + fileExtension;
|
||||
this.fixed = true;
|
||||
},
|
||||
showElement( element ) {
|
||||
document.getElementById( element ).classList.add( 'shown' );
|
||||
},
|
||||
hideElement( element ) {
|
||||
document.getElementById( element ).classList.remove( 'shown' );
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.info-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.info {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: var( --dialog-color );
|
||||
padding: 2vw;
|
||||
width: 20vw;
|
||||
height: 20vh;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.shown {
|
||||
display: block;
|
||||
}
|
||||
.table-container {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -198,6 +233,7 @@ export default {
|
||||
margin-top: 5vh;
|
||||
padding: 1vw 2vw;
|
||||
margin-bottom: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<template>
|
||||
<div class="about">
|
||||
<h1>Settings</h1>
|
||||
<h3>Engines</h3>
|
||||
<p>WIP!</p>
|
||||
<p>{{ engines }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
BIN
logo_upscaled.png
Normal file
BIN
logo_upscaled.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 MiB |
10
smuL-cli.py
10
smuL-cli.py
@@ -42,7 +42,7 @@ def performChecks ( args, ap ):
|
||||
output = args.inputfile[ :len( args.inputfile ) - 4 ] + '_upscaled' + args.inputfile[ len( args.inputfile ) - 4: ]
|
||||
|
||||
# check if output file exists and if, prompt user if it should be overwritten and remove if, if yes
|
||||
if ( os.path.exists( output ) ):
|
||||
if ( os.path.exists( output ) and ( args.overwrite == None or args.overwrite == '' ) ):
|
||||
doReplace = input( '--> File already exists. Do you want to replace it? (Y/n) ' ).lower()
|
||||
if ( doReplace == 'y' or doReplace == '' ):
|
||||
os.remove( output );
|
||||
@@ -54,7 +54,7 @@ def performChecks ( args, ap ):
|
||||
try:
|
||||
engineInfo[ args.engine.lower() ]
|
||||
except KeyError:
|
||||
print( '\n==> ERROR: Engine not available. Ensure you have specified a valid engine. Possible engines: ' )
|
||||
print( '\n==> ERROR: Engine ' + args.engine.lower() + ' not available. Ensure you have specified a valid engine. Possible engines: ' )
|
||||
for entry in engineList:
|
||||
print( ' --> ' + entry )
|
||||
return False
|
||||
@@ -72,7 +72,7 @@ def performChecks ( args, ap ):
|
||||
# Check sharpening argument and also verify that engine supports it
|
||||
if ( args.sharpening != None and args.sharpening != 0 ):
|
||||
if ( float( args.sharpening ) >= 1.0 or float( args.sharpening ) <= 0.0 ):
|
||||
print( '\n==> ERROR: Invalid value for sharpening. Value has to be between 0 and 1' )
|
||||
print( '\n==> ERROR: Invalid value (' + args.sharpening + ') for sharpening. Value has to be between 0 and 1' )
|
||||
return False
|
||||
else:
|
||||
if ( not 'sharpening' in engineInfo[ args.engine ][ 'supports' ] ):
|
||||
@@ -133,6 +133,7 @@ if __name__ == '__main__':
|
||||
ap.add_argument( '-M', '--mode', help='Specify a special mode for a specific engine. Might not be available in every engine. Use the -d option to find out more' )
|
||||
ap.add_argument( '-F', '--filetype', help='Change the file type of the temporary image files. Supports png, jpg. Video quality: png > jpg. PNG is default, if not specified.' )
|
||||
ap.add_argument( '-d', '--details', help='Get details on usage of a particular engine and exit. Reads the config.json file of that engine and displays it in a HR manner' )
|
||||
ap.add_argument( '-y', '--overwrite', help='Always overwrite output path and do not ask', action='store_true' )
|
||||
ap.add_argument( '-p', '--printengines', help='Print all engines and exit', action='store_true' )
|
||||
ap.add_argument( '-v', '--version', help='Print version and exit', action='store_true' )
|
||||
ap.set_defaults( scalefactor = 0, sharpening = 0, threads = 4, engine = 'ffc', filetype = 'png' )
|
||||
@@ -155,5 +156,8 @@ if __name__ == '__main__':
|
||||
if ( engineInfo[ args.engine ][ 'cliModeOptions' ][ option ][ 'default' ] ):
|
||||
mode = option
|
||||
break
|
||||
|
||||
if ( handler.handler( args.inputfile, args.scalefactor, output, args.sharpening, args.filetype, args.engine, mode, args.threads ) ):
|
||||
print( '\n\n---------------------------------------------------------------------------------\n\nDONE \n\n\n\nSimpleMediaUpscalerLite V1.1.0\n\nCopyright 2023 SimpleMediaUpscalerLite contributors\nThis application comes with absolutely no warranty to the extent permitted by applicable law\n\n\n\nOutput was written to ' + output + '\n\n\n' )
|
||||
else:
|
||||
raise Exception( 'ERRORS in arguments' );
|
||||
|
||||
Reference in New Issue
Block a user