def test_2997_fps(): fnum = timespec.time_to_frame(0) assert_equals(0, fnum) fnum = timespec.time_to_frame((1001) / 30.0) assert_equals(1000, fnum) fnum = timespec.time_to_frame(100100 / 30.0) assert_equals(100000, fnum) fnum = timespec.time_to_frame(10010000 / 30.0) assert_equals(10000000, fnum)
def testFloatParse(): s = '0-0.5' conv = lambda x: time_to_frame(float(x)) assert_equal(range(0,15), list(multirange(s, parser=conv)))
"""Parses a range like 234-789 into a tuple (234, 789) """ parts = range_str.split('-') if len(parts) != 2: parser.error("Ranges can only have two parts: start-end") return tuple(float(s) for s in parts) if __name__ == '__main__': (opts, args) = parser.parse_args() if opts.in_bounds and opts.in_times: parser.error("Options --take and --take-times are mutually exclusive") elif opts.in_bounds: frames = multirange(opts.in_bounds) elif opts.in_times: parse = lambda x: time_to_frame(float(x)) frames = multirange(opts.in_times, parser=parse) else: frames = None # set the first frame of output if opts.keep_numbers: out_offset = frames[0] else: out_offset = 0 if len(args) < 2: parser.error("Input file and Output file format are required") (src, dst) = args;
""" parts = range_str.split('-') if len(parts) != 2: parser.error("Ranges can only have two parts: start-end") return tuple(float(s) for s in parts) if __name__ == '__main__': (opts, args) = parser.parse_args() if opts.in_bounds and opts.in_times: parser.error("Options --take and --take-times are mutually exclusive") elif opts.in_bounds: frames = multirange(opts.in_bounds) elif opts.in_times: parse = lambda x: time_to_frame(float(x)) frames = multirange(opts.in_times, parser=parse) else: frames = None # set the first frame of output if opts.keep_numbers: out_offset = frames[0] else: out_offset = 0 if len(args) < 2: parser.error("Input file and Output file format are required") (src, dst) = args extractframes.extract(src,
def testFloatParse(): s = '0-0.5' conv = lambda x: time_to_frame(float(x)) assert_equal(range(0, 15), list(multirange(s, parser=conv)))
def test_frame_starts_with_one(): assert_equals(0, timespec.time_to_frame(0, rate=30))
def test_runs(): timespec.time_to_frame(0, rate=30)
def test_30_fps(): fnum = timespec.time_to_frame(0, rate=30) assert_equals(0, fnum) fnum = timespec.time_to_frame(1, rate=30) assert_equals(30, fnum)
def test_one_fps(): assert_equals(1, timespec.time_to_frame(1, rate=1))