fix sharpening

This commit is contained in:
janis
2023-05-23 09:07:15 +02:00
parent d54e3efb5e
commit 90e00530fd
2 changed files with 17 additions and 17 deletions

View File

@@ -259,11 +259,11 @@ class Handler:
for self.file in self.filelist: for self.file in self.filelist:
self.number += 1 self.number += 1
if ( self.os_type == 'win32' ): if ( self.os_type == 'win32' ):
self.file_list.append( f"{tmppath}{self.file} {tmppath}us\\ig{str(self.number).zfill(8)}.{ filetype } " ); self.file_list.append( f"{tmppath}{self.file} {tmppath}up\\up{str(self.number).zfill(8)}.{ filetype } " );
else: else:
self.file_list.append( f"{tmppath}{self.file} {tmppath}us/ig{str(self.number).zfill(8)}.{ filetype } " ); self.file_list.append( f"{tmppath}{self.file} {tmppath}up/up{str(self.number).zfill(8)}.{ filetype } " );
try: try:
os.mkdir( f'{tmppath}us' ) os.mkdir( f'{tmppath}up' )
except FileExistsError: except FileExistsError:
pass pass
else: else:
@@ -329,9 +329,9 @@ class Handler:
if ( not scaling ): if ( not scaling ):
if ( self.os_type == 'win32' ): if ( self.os_type == 'win32' ):
self.pathSharpening += 'us\\' self.pathSharpening += 'up\\'
elif ( self.os_type == 'linux' ): elif ( self.os_type == 'linux' ):
self.pathSharpening += 'us/' self.pathSharpening += 'up/'
time.sleep( 2 ); time.sleep( 2 );
try: try:
@@ -368,7 +368,7 @@ class Handler:
if ( i == self.threads - 1 ): if ( i == self.threads - 1 ):
for element in self.file_list: for element in self.file_list:
self.files += element; self.files += element;
self.command_list.append( ( self.files, fsrpath, i, self.maxlength, self.os_type, sharpening ) ) self.command_list.append( ( self.files, fsrpath, i, self.maxlength, self.os_type, sharpening, not sharpening ) )
self.pool = multiprocessing.Pool( self.threads ) self.pool = multiprocessing.Pool( self.threads )
self.pool.starmap( sharpeningEngine, self.command_list ); self.pool.starmap( sharpeningEngine, self.command_list );
@@ -417,8 +417,6 @@ def upscalerEngine ( files, fsrpath, quality_setting, number, maxlength, os_type
file_processing = files[posx:posy - pos] file_processing = files[posx:posy - pos]
if file_processing[len(file_processing) - 14:len(file_processing) - 12] == 'ig': if file_processing[len(file_processing) - 14:len(file_processing) - 12] == 'ig':
pos += 5 pos += 5
else:
pass
while files[posy - pos:posy - pos + 1] != ' ': while files[posy - pos:posy - pos + 1] != ' ':
pos += 1 pos += 1
@@ -460,8 +458,6 @@ def bilinearEngine ( files, fsrpath, quality_setting, number, maxlength, os_type
file_processing = files[:maxlength - pos] file_processing = files[:maxlength - pos]
if file_processing[len(file_processing) - 14:len(file_processing) - 12] == 'ig': if file_processing[len(file_processing) - 14:len(file_processing) - 12] == 'ig':
pos += 5 pos += 5
else:
pass
while files[maxlength - pos:maxlength - pos + 1] != ' ': while files[maxlength - pos:maxlength - pos + 1] != ' ':
pos += 1 pos += 1
fileout.append(files[:maxlength - pos]) fileout.append(files[:maxlength - pos])
@@ -517,7 +513,7 @@ def bilinearEngine ( files, fsrpath, quality_setting, number, maxlength, os_type
# #
####################### #######################
def sharpeningEngine ( files, fsrpath, number, maxlength, os_type, sharpening ): def sharpeningEngine ( files, fsrpath, number, maxlength, os_type, sharpening, didUpscale ):
files = files; files = files;
# Refactoring of commands that are longer than 32K characters # Refactoring of commands that are longer than 32K characters
fileout = []; fileout = [];
@@ -526,10 +522,12 @@ def sharpeningEngine ( files, fsrpath, number, maxlength, os_type, sharpening ):
while files[maxlength - pos:maxlength - pos + 1] != ' ': while files[maxlength - pos:maxlength - pos + 1] != ' ':
pos += 1 pos += 1
file_processing = files[:maxlength - pos] file_processing = files[:maxlength - pos]
if file_processing[len(file_processing) - 14:len(file_processing) - 12] == 'ig': if ( didUpscale ):
pos += 5 if file_processing[len(file_processing) - 14:len(file_processing) - 12] == 'up':
pos += 5
else: else:
pass if file_processing[len(file_processing) - 17:len(file_processing) - 15] == 'ru':
pos += 8
while files[maxlength - pos:maxlength - pos + 1] != ' ': while files[maxlength - pos:maxlength - pos + 1] != ' ':
pos += 1 pos += 1
fileout.append(files[:maxlength - pos]) fileout.append(files[:maxlength - pos])
@@ -546,10 +544,12 @@ def sharpeningEngine ( files, fsrpath, number, maxlength, os_type, sharpening ):
while files[posy - pos:posy - pos + 1] != ' ': while files[posy - pos:posy - pos + 1] != ' ':
pos += 1 pos += 1
file_processing = files[posx:posy - pos] file_processing = files[posx:posy - pos]
if file_processing[len(file_processing) - 14:len(file_processing) - 12] == 'ig': if ( didUpscale ):
pos += 5 if file_processing[len(file_processing) - 14:len(file_processing) - 12] == 'up':
pos += 5
else: else:
pass if file_processing[len(file_processing) - 17:len(file_processing) - 15] == 'ru':
pos += 8
while files[posy - pos:posy - pos + 1] != ' ': while files[posy - pos:posy - pos + 1] != ' ':
pos += 1 pos += 1