mirror of https://github.com/AlfredoSequeida/fvid
Prevent negative fractions also
This commit is contained in:
parent
306436886b
commit
e3a17d5263
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue