def cmd(path, c, debug, profile, offset): # pragma: no cover if os.path.isfile(path): files = [path] else: files = glob.glob(path) d = {} for f in files: if f.endswith(('.png', '.jpeg', '.jpg')): filename = os.path.basename(f) hit = re.search(r'(\d+)', filename) t = locate_text(f, debug=debug) if hit: d[int(hit.group()) + offset] = (bool(t), filename) else: t = find_credits(f, offset=offset) if c: img = cv2.read_img(f, cv2.IMREAD_UNCHANGED) height, width, _ = img.shape t = calc_success(t, height, width) if d: click.echo('Image report') for k, v in sorted(d.items()): if v[0] is True: color = 'green' else: color = 'red' click.secho('%s %s %s %s' % (k, sec_to_hh_mm_ss(k), v[0], v[1]), fg=color)
def cmd(path, c, debug, profile, offset): # pragma: no cover if os.path.isfile(path): files = [path] else: files = glob.glob(path) d = {} print(files) for f in files: if f.endswith(image_type): filename = os.path.basename(f) hit = re.search(r'(\d+)', filename) t = locate_text(f, debug=debug) if hit: d[int(hit.group()) + offset] = (bool(t), filename) else: t = find_credits(f, offset=offset) if c: t = calc_success(t, c) if d: click.echo('Image report') for k, v in sorted(d.items()): if v[0] is True: color = 'green' else: color = 'red' click.secho('%s %s %s %s' % (k, sec_to_hh_mm_ss(k), v[0], v[1]), fg=color)
def make_imgz(afile, start=600, dest=None, fps=1): # pragma: no cover """Helper to generate images.""" dest_path = dest + '\out%d.jpg' fps = 'fps=%s' % fps t = sec_to_hh_mm_ss(start) cmd = ['ffmpeg', '-ss', t, '-i', afile, '-vf', fps, dest_path] # fix me subprocess.call(cmd) return dest