From be74be1bf73932fc6696c38970ab6982b45f2de8 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Tue, 28 Mar 2023 14:56:54 +0200 Subject: [PATCH] possible fix for windows --- bin/__pycache__/handler.cpython-310.pyc | Bin 6943 -> 6891 bytes bin/handler.py | 147 ++++++++++++------------ 2 files changed, 74 insertions(+), 73 deletions(-) diff --git a/bin/__pycache__/handler.cpython-310.pyc b/bin/__pycache__/handler.cpython-310.pyc index 065f6be2174dccd58015018d2de11c20267420c0..03b6c83eb251674913aaa92ea9de40b6886dba67 100644 GIT binary patch delta 1943 zcma)7O>7%Q6rMNx>-Bp56Jk4mZPGezO=;7XCa8)^DG*94Q6W_dia{z-W)l)8>vX&Y zQH^UM7jB3|dyLZB>VZpcxg!wbh{V~Y2gHpc#DODKc(Zm~Cn-|Bnz!%G`{sK;J2QST z@nqa7#bOr0U+(uK?1xk9&LG@fKl$DS14ftag6$ghSc4QC*Qv*u(f}Y=2veDMk1(x9 z3kjw(;~ps_8NEUB=KB37>C;H&k^(SNpppf>3X290pkGCZ9sC5p!O-@%bXi`)_4-0o zGDP(rLvt5k;12De*aq@LA?YYv*%B;tNhpCg3>iebAazR~1*)+=jEMJ*j zZ92DC%X72KE}!xi7CpDA%`KP8Zc|+mTi&hMar)ssUb-{h+rcB8@%|O;268QC-{so z>aaHfxi@!dSs1orVbxKgRcuVh>Qp|o$I1vq$Ub0dQDJv&kN% zw7*ANn2;pJ`4{TZqkTQ<;@wj}|Mvxg|8XF=>{+DUr;vKLPtQ71UJE;GNtBmtbvf)w z6_1FlA#`Xhhtz$_OuUUEH3fAd4E+8OZm=!HC=41IH&4YH|M9Pbh$oDjiSyvwIn(RmhwCBoC1yg@otciU8{HvAc(iEA<)!f#m50fY>x zceDEHk|rGX66^h%R^lRF*TZYls1KMd9oE}bV|fynW`r92ocS>o;aNO*{Gt?TDb562 z*`W*aB=WaWyzFuwRyr=7(^6bU(Tptm nF8A@mEC=8BABL;JqyA&LVf3iPv`nl+$I7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LyR_grwM_geKL_Wg>@TS1UPrZV0bIlMP= z+ew-O11O^KGBgP?s1TRpVBsS}ANKcc$6G9M*PtgE7;pV)CbHC^reskAHB880OM;H- zChZS>VOub& self.maxlength: - while files[self.maxlength - pos:self.maxlength - pos + 1] != ' ': - pos += 1 - file_processing = files[:self.maxlength - pos] - if file_processing[len(file_processing) - 14:len(file_processing) - 12] == 'ex': - pos += 5 - else: - pass - while files[self.maxlength - pos:self.maxlength - pos + 1] != ' ': - pos += 1 - fileout.append(files[:self.maxlength - pos]) - filesopt = files[self.maxlength - pos:] - posx = 0 - posy = self.maxlength - - # Command refactoring for commands that are longer than 64K characters - if len(filesopt) > self.maxlength: - while len(filesopt) > self.maxlength: - posx += self.maxlength - pos - posy += self.maxlength - pos - pos = 1 - 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] == 'ex': - pos += 5 - else: - pass - while files[posy - pos:posy - pos + 1] != ' ': - pos += 1 - - file_processing = files[posx:posy - pos] - fileout.append(file_processing) - filesopt = files[posy - pos:] - fileout.append(filesopt) - else: - fileout.append(files[self.maxlength - pos:]) +def upscalerEngine ( quality_mode, files, fsrpath, quality_setting, number, maxlength, os_type ): + files = files; + # Refactoring of commands that are longer than 32K characters + fileout = []; + pos = 0; + if len( files ) > maxlength: + 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] == 'ex': + pos += 5 else: - fileout.append(files) + pass + while files[maxlength - pos:maxlength - pos + 1] != ' ': + pos += 1 + fileout.append(files[:maxlength - pos]) + filesopt = files[maxlength - pos:] + posx = 0 + posy = maxlength - # Upscaling images - print( '\n\n\nUpscaling images... \n\n\n\n\n\n PROCESS: ', number, '\n\n\n' ) - - while len( fileout ) > 0: - files_handle = fileout.pop(0) - if quality_mode == 'default': - if self.os_type == 'linux': - command_us = f'wine {fsrpath} -QualityMode {quality_setting} {files_handle}' - elif self.os_type == 'win32': - command_us = f'FidelityFX_CLI -QualityMode {quality_setting} {files_handle}' + # Command refactoring for commands that are longer than 64K characters + if len(filesopt) > maxlength: + while len(filesopt) > maxlength: + posx += maxlength - pos + posy += maxlength - pos + pos = 1 + 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] == 'ex': + pos += 5 else: - print( 'OS CURRENTLY UNSUPPORTED!' ) - return False + pass + while files[posy - pos:posy - pos + 1] != ' ': + pos += 1 + + file_processing = files[posx:posy - pos] + fileout.append(file_processing) + filesopt = files[posy - pos:] + fileout.append(filesopt) + else: + fileout.append(files[maxlength - pos:]) + else: + fileout.append(files) + + # Upscaling images + print( '\n\n\nUpscaling images... \n\n\n\n\n\n PROCESS: ', number, '\n\n\n' ) + + while len( fileout ) > 0: + files_handle = fileout.pop(0) + if quality_mode == 'default': + if os_type == 'linux': + command_us = f'wine {fsrpath} -QualityMode {quality_setting} {files_handle}' + elif os_type == 'win32': + command_us = f'FidelityFX_CLI -QualityMode {quality_setting} {files_handle}' else: - if self.os_type == "linux": - command_us = f'wine {fsrpath} -Scale {quality_setting} {quality_setting} {files_handle}' - elif self.os_type == "win32": - command_us = f'FidelityFX_CLI -Scale {quality_setting} {quality_setting} {files_handle}' - else: - print( 'OS CURRENTLY UNSUPPORTED!' ) - return False - sub = subprocess.Popen( command_us, shell=True ); - sub.wait(); - time.sleep(3) - print( '\n\nCompleted executing Job\n\n\n PROCESS: ', number, '\n\n\n' ); + print( 'OS CURRENTLY UNSUPPORTED!' ) + return False + else: + if os_type == "linux": + command_us = f'wine {fsrpath} -Scale {quality_setting} {quality_setting} {files_handle}' + elif os_type == "win32": + command_us = f'FidelityFX_CLI -Scale {quality_setting} {quality_setting} {files_handle}' + else: + print( 'OS CURRENTLY UNSUPPORTED!' ) + return False + sub = subprocess.Popen( command_us, shell=True ); + sub.wait(); + time.sleep(3) + print( '\n\nCompleted executing Job\n\n\n PROCESS: ', number, '\n\n\n' );