-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
29 lines (23 loc) · 816 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import shutil
from dotenv import load_dotenv
from src.split_and_save_tiles import split_and_save_tiles
from src.get_absolute_path import get_absolute_path
load_dotenv()
def main():
input_folder = get_absolute_path(os.getenv("INPUT_DIR"))
output_folder = get_absolute_path(os.getenv("OUTPUT_DIR"))
if not os.path.exists(output_folder):
os.makedirs(output_folder)
else:
shutil.rmtree(output_folder)
os.mkdir(output_folder)
print("Output folder")
for level in range(int(os.getenv("LEVEL_MAX"))):
level_folder = f"{output_folder}/{level}"
if not os.path.exists(level_folder):
os.mkdir(level_folder)
split_and_save_tiles(input_folder, level + 1, level_folder)
print("Done!")
if __name__ == "__main__":
main()