diff --git a/bin/__pycache__/handler.cpython-311.pyc b/bin/__pycache__/handler.cpython-311.pyc index fe5be8c..db72be3 100644 Binary files a/bin/__pycache__/handler.cpython-311.pyc and b/bin/__pycache__/handler.cpython-311.pyc differ diff --git a/bin/handler.py b/bin/handler.py index 37b3300..41ea9fb 100755 --- a/bin/handler.py +++ b/bin/handler.py @@ -119,7 +119,11 @@ class Handler: # Retrieving Video metadata self.filelist = os.listdir(self.tmppath) - self.videometa = ffmpeg.probe(str(input_path))['streams'].pop(0) + try: + self.videometa = ffmpeg.probe(str(input_path))['streams'].pop(0) + except Exception: + print( '\n\n==> Failed to execute ffprobe. Please ensure that you have a valid ffmpeg & ffprobe installation.\n --> Refer to our wiki for a guide on a proper installation\n\n') + return False; self.duration = self.videometa.get( 'duration' ) self.frames = len( self.filelist ) @@ -175,4 +179,6 @@ class Handler: else: print( 'OS CURRENTLY UNSUPPORTED!' ); return False - os.system( self.command ) \ No newline at end of file + os.system( self.command ) + + return True; \ No newline at end of file diff --git a/smuL-cli.py b/smuL-cli.py index cae66ef..49c5a11 100644 --- a/smuL-cli.py +++ b/smuL-cli.py @@ -68,8 +68,8 @@ def performChecks ( args, ap ): return False # Check sharpening argument and also verify that engine supports it - if ( args.sharpening != None and args.sharpening != 0 ): - if ( float( args.sharpening ) >= 1 and float( args.sharpening ) <= 0 ): + if ( args.sharpening != None and args.sharpening != 0 ): + if ( float( args.sharpening ) >= 1.0 or float( args.sharpening ) <= 0.0 ): print( '\n==> ERROR: Invalid value for sharpening. Value has to be between 0 and 1' ) return False else: @@ -128,7 +128,7 @@ if __name__ == '__main__': ap.add_argument( '-d', '--details', help='Get details on usage of a particular engine and exit. Reads the config.json file of that engine and displays it in a HR manner' ) ap.add_argument( '-p', '--printengines', help='Print all engines and exit', action='store_true' ) ap.add_argument( '-v', '--version', help='Print version and exit', action='store_true' ) - ap.set_defaults( scaling = 0, sharpening = 0, threads = 4, engine = 'fsr', filetype = 'png' ) + ap.set_defaults( scalefactor = 0, sharpening = 0, threads = 4, engine = 'fsr', filetype = 'png' ) args = ap.parse_args() handler = bin.handler.Handler() @@ -148,7 +148,5 @@ if __name__ == '__main__': if ( engineInfo[ args.engine ][ 'cliModeOptions' ][ option ][ 'default' ] ): mode = option break - handler.handler( args.inputfile, args.scalefactor, output, args.sharpening, args.filetype, args.engine, mode, args.threads ) - print( '\n\n---------------------------------------------------------------------------------\n\nDONE \n\n\n\nSimpleMediaScalerLiteFrontend V1.1.0\n\nCopyright 2023 FSRSimpleMediaScalerLiteFrontend contributors\nThis application comes with absolutely no warranty to the extent permitted by applicable law\n\n\n\nOutput was written to ' + output + '\n\n\n' ) - - + if ( handler.handler( args.inputfile, args.scalefactor, output, args.sharpening, args.filetype, args.engine, mode, args.threads ) ): + print( '\n\n---------------------------------------------------------------------------------\n\nDONE \n\n\n\nSimpleMediaScalerLite V1.1.0\n\nCopyright 2023 SimpleMediaScalerLite contributors\nThis application comes with absolutely no warranty to the extent permitted by applicable law\n\n\n\nOutput was written to ' + output + '\n\n\n' )