From ad64287a8ae104d9bca9a4a40de8d0f9ca7eea82 Mon Sep 17 00:00:00 2001 From: janis Date: Fri, 9 Jun 2023 09:52:43 +0200 Subject: [PATCH 01/14] make cli output better --- bin/__pycache__/handler.cpython-311.pyc | Bin 11137 -> 11141 bytes bin/engines/ffc/ffc.py | 1 + bin/handler.py | 2 +- 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/__pycache__/handler.cpython-311.pyc b/bin/__pycache__/handler.cpython-311.pyc index faec4af3e50d234356999115b7d2ece7a1f2fde9..f7525e77919a71bae0f94e046adf9d74c3c961d7 100644 GIT binary patch delta 121 zcmZn+Zw=>N&dbZi00g&hG^HeM-?sd z_)Rxd9k9L-5Pcyw{X%BJg`%l}KQIP^Af?eIP!eIYF2LQ>|1?EDLbrB@1TFLKmh;i$g=Lz}~d=8N$i_@% diff --git a/bin/engines/ffc/ffc.py b/bin/engines/ffc/ffc.py index ff846b2..efbd4df 100644 --- a/bin/engines/ffc/ffc.py +++ b/bin/engines/ffc/ffc.py @@ -47,6 +47,7 @@ class Scaler: os.system( self.command ) print( '\n\n==> Photo upscaled' ); + return True def videoScaler ( self, tmppath, threads, scalefactor, sharpening, filetype, mode ): self.isScaling = True diff --git a/bin/handler.py b/bin/handler.py index 650545d..4d67a42 100755 --- a/bin/handler.py +++ b/bin/handler.py @@ -96,7 +96,7 @@ class Handler: def photo_scaling(self, input_path, output_path, scalefactor, sharpening, threads, engine, mode ): # DO NOT CALL THIS! Use Handler().handler() instead! - importedModules[ engine ].singleScaler( input_path, output_path, scalefactor, sharpening, threads, mode, self.tmppath ); + return importedModules[ engine ].singleScaler( input_path, output_path, scalefactor, sharpening, threads, mode, self.tmppath ); def video_scaling( self, input_path, output_path, scalefactor, threads, sharpening, filetype, mode, engine ): self.engineSetting = json.load( open( 'bin/engines/' + engine + '/config.json' ) ) From 573450dee94f26ff5fc186c569836f5c56933ce8 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Fri, 9 Jun 2023 14:59:02 +0200 Subject: [PATCH 02/14] add debug code --- bin/engines/ffc/ffc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/engines/ffc/ffc.py b/bin/engines/ffc/ffc.py index efbd4df..7f7e2c3 100644 --- a/bin/engines/ffc/ffc.py +++ b/bin/engines/ffc/ffc.py @@ -239,6 +239,7 @@ def upscalerEngine ( files, scalefactor, number, maxlength, os_type, version ): else: print( 'OS CURRENTLY UNSUPPORTED!' ) return False + print( command_us ); sub = subprocess.Popen( command_us, shell=True ); sub.wait(); time.sleep(3) @@ -313,6 +314,7 @@ def sharpeningEngine ( files, number, maxlength, os_type, sharpening, didUpscale else: print( 'OS CURRENTLY UNSUPPORTED!' ) return False + print( command_sharpening ); sub2 = subprocess.Popen( command_sharpening, shell=True ); sub2.wait() time.sleep(3) From a3d1362d50edcd1703c0d34affba8ea8600eaeed Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Fri, 9 Jun 2023 15:38:37 +0200 Subject: [PATCH 03/14] fix bug with fsr upscaler on windows --- bin/__pycache__/handler.cpython-311.pyc | Bin 11141 -> 11145 bytes bin/__pycache__/probe.cpython-311.pyc | Bin 3777 -> 3781 bytes bin/engines/ffc/ffc.py | 23 ++++++++++++++--------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bin/__pycache__/handler.cpython-311.pyc b/bin/__pycache__/handler.cpython-311.pyc index f7525e77919a71bae0f94e046adf9d74c3c961d7..086efc86db7f164f591255fdb918587f22cad129 100644 GIT binary patch delta 36 qcmZn-?+oW&&dbZi00dhVn>TXrVrF!me2m$MCEhQ!eDe?HUUdMxJPRlQ delta 31 lcmeASZw=>O&dbZi00g&hG;QSG#mwk9`53d&=0D86>HwQo3U>ei diff --git a/bin/__pycache__/probe.cpython-311.pyc b/bin/__pycache__/probe.cpython-311.pyc index cd2cf334c60e68ac0bb6767b405da7375df88ebd..99d204e20ef47ae6d2e104664b4a633b801b0147 100644 GIT binary patch delta 36 rcmX>odsLQtIWI340}$N*TC$P*6f>jqqdr+2pIWI340}u$ClyBrd#ms0w`5Lp)W*(NETmXPr2toh= diff --git a/bin/engines/ffc/ffc.py b/bin/engines/ffc/ffc.py index 7f7e2c3..3d321a4 100644 --- a/bin/engines/ffc/ffc.py +++ b/bin/engines/ffc/ffc.py @@ -54,13 +54,17 @@ class Scaler: if ( scalefactor == 0 or scalefactor == None ): self.isScaling = False + self.isSharpening = True + if sharpening != 0 and sharpening != None: + self.isSharpening = False + # Locate Images and assemble FSR-Command self.file_list = [] self.filelist = os.listdir( tmppath ) self.filelist.pop(0) self.filelist.sort() self.number = 0 - if sharpening != 0 and sharpening != None: + if self.isSharpening: for self.file in self.filelist: self.number += 1 if ( self.os_type == 'win32' ): @@ -116,14 +120,14 @@ class Scaler: if ( i == self.threads - 1 ): for element in self.file_list: self.files += element; - self.command_list.append( ( self.files, scalefactor, i, self.maxlength, self.os_type, mode ) ) + self.command_list.append( ( self.files, scalefactor, i, self.maxlength, self.os_type, mode, self.isSharpening ) ) self.pool = multiprocessing.Pool( self.threads ) self.pool.starmap( upscalerEngine, self.command_list ); self.pool.close(); self.pool.join(); - if sharpening != 0 and sharpening != None: + if self.isSharpening: print( f'\n\n\n==> Sharpening using { self.threads } threads <==\n\n' ); time.sleep( 2 ); @@ -179,7 +183,10 @@ class Scaler: # Add return values -def upscalerEngine ( files, scalefactor, number, maxlength, os_type, version ): +def upscalerEngine ( files, scalefactor, number, maxlength, os_type, version, isSharpening ): + comparison = 'sc' + if ( isSharpening ): + comparison = 'up' scaler = 'FSR' if ( version.upper() == 'HQC' ): scaler = 'HighQualityCubic' @@ -193,7 +200,7 @@ def upscalerEngine ( files, scalefactor, number, maxlength, os_type, version ): while files[maxlength - pos:maxlength - pos + 1] != ' ': pos += 1 file_processing = files[:maxlength - pos] - if file_processing[len(file_processing) - 14:len(file_processing) - 12] == 'ig': + if file_processing[len(file_processing) - 17:len(file_processing) - 15] != comparison: pos += 5 else: pass @@ -213,7 +220,7 @@ def upscalerEngine ( files, scalefactor, number, maxlength, os_type, version ): while files[posy - pos:posy - pos + 1] != ' ': pos += 1 file_processing = files[posx:posy - pos] - if file_processing[len(file_processing) - 14:len(file_processing) - 12] == 'ig': + if file_processing[len(file_processing) - 17:len(file_processing) - 15] != comparison: pos += 5 while files[posy - pos:posy - pos + 1] != ' ': pos += 1 @@ -239,7 +246,6 @@ def upscalerEngine ( files, scalefactor, number, maxlength, os_type, version ): else: print( 'OS CURRENTLY UNSUPPORTED!' ) return False - print( command_us ); sub = subprocess.Popen( command_us, shell=True ); sub.wait(); time.sleep(3) @@ -262,7 +268,7 @@ def sharpeningEngine ( files, number, maxlength, os_type, sharpening, didUpscale pos += 1 file_processing = files[:maxlength - pos] if ( didUpscale ): - if file_processing[len(file_processing) - 14:len(file_processing) - 12] == 'up': + if file_processing[len(file_processing) - 17:len(file_processing) - 15] == 'up': pos += 5 else: if file_processing[len(file_processing) - 17:len(file_processing) - 15] == 'ru': @@ -314,7 +320,6 @@ def sharpeningEngine ( files, number, maxlength, os_type, sharpening, didUpscale else: print( 'OS CURRENTLY UNSUPPORTED!' ) return False - print( command_sharpening ); sub2 = subprocess.Popen( command_sharpening, shell=True ); sub2.wait() time.sleep(3) From 739f17283ffc7792916bbc06cb036362c895990b Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Fri, 9 Jun 2023 15:40:58 +0200 Subject: [PATCH 04/14] make cli output better --- bin/handler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/handler.py b/bin/handler.py index 4d67a42..9d6d66b 100755 --- a/bin/handler.py +++ b/bin/handler.py @@ -172,6 +172,9 @@ class Handler: # reassemble Video print( '\n\n==> Reassembling Video... with framerate @', self.framerate, '\n\n' ) + + time.wait( 2 ) + if self.os_type == 'linux': self.command = f'ffmpeg -framerate {self.framerate} -i {self.tmppath}{self.engineSetting[ "lastUsedFilePath" ]}/{self.engineSetting[ "fileNameBeginning" ]}%08d.{filetype} {output_path} -i {self.tmppath}audio.aac' elif self.os_type == 'win32': From 73661fae19cd5e3088643575ef01fdfe60032e8f Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Fri, 9 Jun 2023 15:49:38 +0200 Subject: [PATCH 05/14] fix cli crash if engine does not exist in -d flag --- bin/__pycache__/handler.cpython-311.pyc | Bin 11145 -> 11204 bytes smuL-cli.py | 5 +++++ 2 files changed, 5 insertions(+) diff --git a/bin/__pycache__/handler.cpython-311.pyc b/bin/__pycache__/handler.cpython-311.pyc index 086efc86db7f164f591255fdb918587f22cad129..81aa30108399d834319ea3aea432cde87d069844 100644 GIT binary patch delta 214 zcmeASKN8NnoR^o20SMOWG^bQ=S-WkrjoR^o20SLA#Hm4+QRE*C?+$yZvLaV znuYPk=B;Y|Op?KjtfC(nu#l5uHP16fPuA6vV9ea?re)7)AIQWAREnMa2p0c>L$*j5 G=q> ' + entry ) print( '\n\n' ) else: + try: + engineInfo[ args.details.lower() ] + except KeyError: + print( '\n\n ==> That engine does not exist. Please use the -p option to check for available engines!\n\n' ) + return False print( '\n\n ==> INFOS about ' + engineInfo[ args.details.lower() ][ 'displayName' ] + '\n' ) print( ' --> Engine cli option is: ' + engineInfo[ args.details ][ 'abbr' ].lower() ) print( ' --> CLI mode options are: ' ) From c01948dc3f8f355f119d3e98b921098d519ea056 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Fri, 9 Jun 2023 17:03:25 +0200 Subject: [PATCH 06/14] fix lots of GUI bugs + styling a lil --- bin/__pycache__/handler.cpython-311.pyc | Bin 11204 -> 11185 bytes bin/engines/ss/ss.py | 1 + bin/handler.py | 4 +-- frontend/src/App.vue | 5 ++-- frontend/src/assets/logo.png | Bin 6849 -> 606493 bytes frontend/src/upscalingHandler.js | 16 +++++++++-- frontend/src/views/AboutView.vue | 2 +- frontend/src/views/HomeView.vue | 36 ++++++++++++++++++++++++ frontend/src/views/SettingsView.vue | 2 -- logo_upscaled.png | Bin 0 -> 3066836 bytes smuL-cli.py | 10 +++++-- 11 files changed, 63 insertions(+), 13 deletions(-) mode change 100644 => 100755 frontend/src/assets/logo.png create mode 100644 logo_upscaled.png diff --git a/bin/__pycache__/handler.cpython-311.pyc b/bin/__pycache__/handler.cpython-311.pyc index 81aa30108399d834319ea3aea432cde87d069844..62915c61a6b5a0646efcca4ce2ec9915a1c7303d 100644 GIT binary patch delta 147 zcmX>SzA>D4IWI340}!y7Hm7uM`S#gr?N$LO4)q+J%gqi^6$Vg!3-&D7CqiiH zID9vAa&j>;>P!~l3StI|ZcgQz&cyg?^Ix7=CM_O;>pXIoc;psvtkB+2eZc)h)P=~z z3(4shGV?F;6kg#eyZ}R+>-n`AHPF<1T?h!j5E*|VG4&!(`W2q^3ox|#jKEVV0L*tg An*aa+ diff --git a/bin/engines/ss/ss.py b/bin/engines/ss/ss.py index 75ccfee..938670c 100644 --- a/bin/engines/ss/ss.py +++ b/bin/engines/ss/ss.py @@ -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' } diff --git a/bin/handler.py b/bin/handler.py index 9d6d66b..25fafa8 100755 --- a/bin/handler.py +++ b/bin/handler.py @@ -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 diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 8e8ecaa..e7ae4b9 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,8 +1,9 @@