Skip to content

Commit

Permalink
clean work dir. Not efficient but at least it makes the compile more …
Browse files Browse the repository at this point in the history
…predictable
  • Loading branch information
relleums committed Apr 2, 2024
1 parent 684beed commit 652790b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pyslidescape/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,22 @@ def get_cache_dir(work_dir):
return os.path.join(work_dir, ".cache")


def clean_work_dir(work_dir):
group_dirs = list_slides_dirs(work_dir)
for group_dir in group_dirs:
layer_slide_paths = glob(path=group_dir, pattern=".*-*.svg")
for layer_slide_path in layer_slide_paths:
print("rm", layer_slide_path)
os.remove(layer_slide_path)


def compile(work_dir, out_path, author=None, num_threads=1):
cache_dir = get_cache_dir(work_dir)
os.makedirs(cache_dir, exist_ok=True)
pool = multiprocessing.Pool(num_threads)

clean_work_dir(work_dir=work_dir)

# roll out svgs with layers
# -------------------------
layers_jobs = inkscape_svg_roll_out_layers_make_jobs(work_dir=work_dir)
Expand Down

0 comments on commit 652790b

Please sign in to comment.