From 0466c9db9d3b5e7a94c128dda36bfaecc84703dc Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Wed, 15 Mar 2023 19:41:25 +0100 Subject: [PATCH] fixes --- bin/handler.py | 9 ++++----- fsrimagevideoupscaler-cli.py | 9 ++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/bin/handler.py b/bin/handler.py index 410a0a0..0e34743 100644 --- a/bin/handler.py +++ b/bin/handler.py @@ -49,7 +49,6 @@ class Handler: self.tmppath += "fsru/" else: self.tmppath += '/fsru/' - self.ffmpegpath = config["PathSettings"]["ffmpeg"] # checking for spaces in filepath (for use with terminal commands) self.filepath = "" for self.letter in filepath: @@ -61,7 +60,7 @@ class Handler: # Determining filetype if str(filepath)[len(filepath) - 4:] == ".mp4" or str(filepath)[len(filepath) - 4:] == ".mkv": print("upscaling video") - self.video_scaling(self.ffmpegpath, fsrpath, filepath, quality_mode, quality_setting, output_path) + self.video_scaling(fsrpath, filepath, quality_mode, quality_setting, output_path) 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("upscaling image") self.photo_scaling(fsrpath, filepath, quality_mode, quality_setting, output_path) @@ -92,7 +91,7 @@ class Handler: os.system(self.command) print("photo upscaled") - def video_scaling(self, ffmpegpath, fsrpath, filepath, quality_mode, quality_setting, output_path): + def video_scaling(self, fsrpath, filepath, quality_mode, quality_setting, output_path): # DO NOT CALL THIS! Use Handler().handler() instead! # if ( sys.platform == 'win32' ): # self.videometa = ffmpeg.probe(str(filepath))["streams"].pop(0) @@ -222,7 +221,7 @@ class Handler: if self.os_type == "linux": self.command = f"ffmpeg -i {self.filepath} -vn -acodec copy {self.tmppath}audio.aac" elif self.os_type == "win32": - self.command = f"{ffmpegpath} -i {self.filepath} -vn -acodec copy {self.tmppath}audio.aac" + self.command = f"ffmpeg -i {self.filepath} -vn -acodec copy {self.tmppath}audio.aac" else: print("OS CURRENTLY UNSUPPORTED!") return False @@ -233,7 +232,7 @@ class Handler: if self.os_type == "linux": self.command = f"ffmpeg -framerate {self.framerate} -i {self.tmppath}sc/ig%08d.png {output_path} -i {self.tmppath}audio.aac" elif self.os_type == "win32": - self.command = f"{ffmpegpath} -framerate {self.framerate} -i {self.tmppath}sc/ig%08d.png {output_path} -i {self.tmppath}audio.aac" + self.command = f"ffmpeg -framerate {self.framerate} -i ${self.tmppath}sc/ig%08d.png {output_path} -i {self.tmppath}audio.aac" else: print("OS CURRENTLY UNSUPPORTED!") return False diff --git a/fsrimagevideoupscaler-cli.py b/fsrimagevideoupscaler-cli.py index 133dc4f..3097bd9 100644 --- a/fsrimagevideoupscaler-cli.py +++ b/fsrimagevideoupscaler-cli.py @@ -18,7 +18,10 @@ args = ap.parse_args() handler = bin.handler.Handler() -if ( args.scalefactor[ len(args.scalefactor) -1: ] == 'x' ): - handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, 'custom', args.scalefactor, args.outputfile ) +if ( args.scalefactor ): + if ( args.scalefactor[ len(args.scalefactor) -1: ] == 'x' ): + handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, 'custom', args.scalefactor, args.outputfile ) + else: + raise NameError( 'Argument Scale does require to be of form 2x! (it has to end in x)' ) else: - raise NameError( 'Argument Scale does require to be of form 2x! (it has to end in x)' ) \ No newline at end of file + handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, 'custom', '2x', args.outputfile ) \ No newline at end of file