From 1beadbdc3db38ab94734d6647edcf4f34d208f81 Mon Sep 17 00:00:00 2001 From: rlx Date: Tue, 10 Aug 2021 08:57:44 +0000 Subject: [PATCH] fix curly braces, don't create directory on launch --- pc.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pc.py b/pc.py index 37c5cf0..78211f1 100644 --- a/pc.py +++ b/pc.py @@ -27,7 +27,6 @@ from PIL import Image video_fn = 'The Man with the Movie Camera.mkv' video_dn = '.'.join(video_fn.split('.')[:-1]) src_dn = f'{video_dn}/src' -os.makedirs(src_dn, exist_ok=True) m = 16 # Matrix size m2 = m ** 2 @@ -73,7 +72,7 @@ def read_images(): os.system(f'ffmpeg -i "{video_fn}" -q:v 1 "{src_dn}/%08d.jpg"') cell_dn = f'{src_dn}_{cell_w}x{cell_h}' os.makedirs(cell_dn, exist_ok=True) - src_fns = [f'src_dn/{fn}' for fn in os.listdir(src_dn) if fn[0] != '.'] + src_fns = [f'{src_dn}/{fn}' for fn in os.listdir(src_dn) if fn[0] != '.'] src_fns = sorted(src_fns) n = len(src_fns) data_fn = f'{video_dn}/{cx}x{cy}.npy' @@ -104,7 +103,7 @@ def write_images(data): global cache_hits dst_dn = f'{video_dn}/dst_{m}x{m}x{cx}x{cy}_{kf}' os.makedirs(dst_dn, exist_ok=True) - src_fns = [f'src_dn/{fn}' for fn in os.listdir(src_dn) if fn[0] != '.'] + src_fns = [f'{src_dn}/{fn}' for fn in os.listdir(src_dn) if fn[0] != '.'] src_fns = sorted(src_fns) n = len(src_fns) tree = cKDTree(data if kf == 1 else [data[i] for i in range(0, n, kf)])