From b79e206f0dd8299479e52619c025bcdc6df7e594 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Wed, 7 Jun 2023 12:13:30 +0200 Subject: [PATCH] add relative path call for engines --- bin/engines/fsr/fsr.py | 8 ++++---- bin/engines/ss/ss.py | 4 ++-- bin/handler.py | 5 +++-- config/settings.ini | 2 -- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/bin/engines/fsr/fsr.py b/bin/engines/fsr/fsr.py index f7fc068..ff846b2 100644 --- a/bin/engines/fsr/fsr.py +++ b/bin/engines/fsr/fsr.py @@ -28,7 +28,7 @@ class Scaler: if self.os_type == 'linux': self.command = f'wine ./bin/lib/FidelityFX_CLI.exe -Mode { scaler } -Scale {scalefactor}x {scalefactor}x {input_path} {output}' elif self.os_type == 'win32': - self.command = f'FidelityFX_CLI -Mode { scaler } -Scale {scalefactor}x {scalefactor}x {input_path} {output}' + self.command = f'bin\\lib\\FidelityFX_CLI.exe -Mode { scaler } -Scale {scalefactor}x {scalefactor}x {input_path} {output}' else: print( 'OS CURRENTLY UNSUPPORTED!' ) return False @@ -39,7 +39,7 @@ class Scaler: if self.os_type == 'linux': self.command = f'wine ./bin/lib/FidelityFX_CLI.exe -Mode CAS -Sharpness {sharpening} {output} {output_path}' elif self.os_type == 'win32': - self.command = f'FidelityFX_CLI -Mode CAS -Sharpness {sharpening} {output} {output_path}' + self.command = f'bin\\lib\\FidelityFX_CLI.exe -Mode CAS -Sharpness {sharpening} {output} {output_path}' else: print( 'OS CURRENTLY UNSUPPORTED!' ) return False @@ -234,7 +234,7 @@ def upscalerEngine ( files, scalefactor, number, maxlength, os_type, version ): if os_type == 'linux': command_us = f'wine ./bin/lib/FidelityFX_CLI.exe -Mode { scaler } -Scale {scalefactor}x {scalefactor}x {files_handle}' elif os_type == 'win32': - command_us = f'FidelityFX_CLI -Mode { scaler } -Scale {scalefactor}x {scalefactor}x {files_handle}' + command_us = f'bin\\lib\\FidelityFX_CLI.exe -Mode { scaler } -Scale {scalefactor}x {scalefactor}x {files_handle}' else: print( 'OS CURRENTLY UNSUPPORTED!' ) return False @@ -308,7 +308,7 @@ def sharpeningEngine ( files, number, maxlength, os_type, sharpening, didUpscale if os_type == 'linux': command_sharpening = f'wine ./bin/lib/FidelityFX_CLI.exe -Mode CAS -Sharpness {sharpening} {files_handle}' elif os_type == 'win32': - command_sharpening = f'FidelityFX_CLI -Mode CAS -Sharpness {sharpening} {files_handle}' + command_sharpening = f'bin\\lib\\FidelityFX_CLI.exe -Mode CAS -Sharpness {sharpening} {files_handle}' else: print( 'OS CURRENTLY UNSUPPORTED!' ) return False diff --git a/bin/engines/ss/ss.py b/bin/engines/ss/ss.py index bf7db91..75ccfee 100644 --- a/bin/engines/ss/ss.py +++ b/bin/engines/ss/ss.py @@ -16,7 +16,7 @@ class Scaler: if self.os_type == 'linux': self.command = f'wine ./bin/lib/realesrgan-ncnn-vulkan.exe -i {input_path} -o {output_path} -s {scalefactor} -j {threads}:{threads}:{threads} -n { modes[ mode ] }' elif self.os_type == 'win32': - self.command = f'realesrgan-ncnn-vulkan -i {input_path} -o {output_path} -s {scalefactor} -j {threads}:{threads}:{threads} -n { modes[ mode ] }' + self.command = f'bin\\lib\\realesrgan-ncnn-vulkan.exe -i {input_path} -o {output_path} -s {scalefactor} -j {threads}:{threads}:{threads} -n { modes[ mode ] }' else: print( 'OS CURRENTLY UNSUPPORTED!' ) return False @@ -34,7 +34,7 @@ class Scaler: except FileExistsError: pass if ( self.os_type == 'win32' ): - self.command = f'realesrgan-ncnn-vulkan -i {tmppath} -o {tmppath}sc -s {scalefactor} -j {threads}:{threads}:{threads} -n {modes[ mode ]}' + self.command = f'bin\\lib\\realesrgan-ncnn-vulkan.exe -i {tmppath} -o {tmppath}sc -s {scalefactor} -j {threads}:{threads}:{threads} -n {modes[ mode ]}' elif ( self.os_type == 'linux' ): self.command = f'wine ./bin/lib/realesrgan-ncnn-vulkan.exe -i {tmppath} -o {tmppath}sc -s {scalefactor} -j {threads}:{threads}:{threads} -n {modes[ mode ]}' os.system( self.command ); \ No newline at end of file diff --git a/bin/handler.py b/bin/handler.py index 859eca8..37b3300 100755 --- a/bin/handler.py +++ b/bin/handler.py @@ -17,6 +17,7 @@ import json import importlib import shutil import time +import tempfile importedModules = {} @@ -50,9 +51,9 @@ class Handler: print( '\n\n SimpleMediaScalerLite - V1.1.0\n\n(c) 2023 SimpleMediaScalerLite contributors\n\n\n\n' ); if self.os_type == 'linux': - self.tmppath = config['PathSettings']['tmpPathLinux'] + self.tmppath = tempfile.gettempdir() elif self.os_type == 'win32': - self.tmppath = config['PathSettings']['tmpPathWindows'] + self.tmppath = tempfile.gettempdir() else: print('OS CURRENTLY UNSUPPORTED!') return False diff --git a/config/settings.ini b/config/settings.ini index 8ee5b59..4426dd3 100755 --- a/config/settings.ini +++ b/config/settings.ini @@ -1,7 +1,5 @@ [PathSettings] defaultOutputPath = $HOME/FSRSimpleMediaScalerLite/ -tmpPathLinux = /tmp/ -tmpPathWindows = C:\temp [DevSettings] loggerReqLevel = DEBUG \ No newline at end of file