diff --git a/fvid/fvid.py b/fvid/fvid.py index f54b21c..1b75d61 100644 --- a/fvid/fvid.py +++ b/fvid/fvid.py @@ -219,8 +219,9 @@ def main(): save_bits_to_file("./", bits) elif args.encode: - # isdigit has the benefit of raising an error if the user passes a negative string - if not args.framerate.isdigit() and "/" not in args.framerate: + # isdigit has the benefit of being True and raising an error if the user passes a negative string + # all() lets us check if both the negative sign and forward slash are in the string, to prevent negative fractions + if (not args.framerate.isdigit() and "/" not in args.framerate) or all(x in args.framerate for x in ("-", "/")): raise NotImplementedError("The framerate must be a positive fraction or an integer for now, like 3, '1/3', or '1/5'!") # get bits from file bits = get_bits_from_file(args.input)