add various fixes for bugs

This commit is contained in:
2023-06-07 19:57:31 +02:00
parent 98f2ec28ce
commit d19435277f
3 changed files with 13 additions and 9 deletions

View File

@@ -119,7 +119,11 @@ class Handler:
# Retrieving Video metadata # Retrieving Video metadata
self.filelist = os.listdir(self.tmppath) self.filelist = os.listdir(self.tmppath)
try:
self.videometa = ffmpeg.probe(str(input_path))['streams'].pop(0) 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.duration = self.videometa.get( 'duration' )
self.frames = len( self.filelist ) self.frames = len( self.filelist )
@@ -176,3 +180,5 @@ class Handler:
print( 'OS CURRENTLY UNSUPPORTED!' ); print( 'OS CURRENTLY UNSUPPORTED!' );
return False return False
os.system( self.command ) os.system( self.command )
return True;

View File

@@ -69,7 +69,7 @@ def performChecks ( args, ap ):
# Check sharpening argument and also verify that engine supports it # Check sharpening argument and also verify that engine supports it
if ( args.sharpening != None and args.sharpening != 0 ): if ( args.sharpening != None and args.sharpening != 0 ):
if ( float( args.sharpening ) >= 1 and float( 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' ) print( '\n==> ERROR: Invalid value for sharpening. Value has to be between 0 and 1' )
return False return False
else: 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( '-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( '-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.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() args = ap.parse_args()
handler = bin.handler.Handler() handler = bin.handler.Handler()
@@ -148,7 +148,5 @@ if __name__ == '__main__':
if ( engineInfo[ args.engine ][ 'cliModeOptions' ][ option ][ 'default' ] ): if ( engineInfo[ args.engine ][ 'cliModeOptions' ][ option ][ 'default' ] ):
mode = option mode = option
break break
handler.handler( args.inputfile, args.scalefactor, output, args.sharpening, args.filetype, args.engine, mode, args.threads ) 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\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' ) 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' )