Spaces:
Sleeping
Sleeping
| import os, json | |
| import PIL.Image | |
| # Pillow ANTIALIAS patch for compatibility with MoviePy | |
| if not hasattr(PIL.Image, "ANTIALIAS"): | |
| PIL.Image.ANTIALIAS = PIL.Image.LANCZOS | |
| ROOT = os.getcwd() | |
| OUT_DIR = os.path.join(ROOT, "export") | |
| TMP_DIR = os.path.join(ROOT, "_tmp_capsules") | |
| os.makedirs(OUT_DIR, exist_ok=True) | |
| os.makedirs(TMP_DIR, exist_ok=True) | |
| CONFIG_PATH = os.path.join(ROOT, "app_config.json") | |
| if os.path.exists(CONFIG_PATH): | |
| cfg = json.load(open(CONFIG_PATH, "r", encoding="utf-8")) | |
| THEMES = cfg["themes"] | |
| FONT_REG = cfg["font_paths"]["regular"] | |
| FONT_BOLD = cfg["font_paths"]["bold"] | |
| else: | |
| THEMES = { | |
| "Bleu Professionnel": {"primary": [0, 82, 147], "secondary": [0, 126, 200]}, | |
| "Vert Gouvernemental": {"primary": [0, 104, 55], "secondary": [0, 155, 119]}, | |
| "Violet Élégant": {"primary": [74, 20, 140], "secondary": [103, 58, 183]}, | |
| } | |
| FONT_REG = "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf" | |
| FONT_BOLD = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" | |
| W, H = 1920, 1080 | |
| MARGIN_X, SAFE_Y_TOP = 140, 140 | |
| MANIFEST_PATH = os.path.join(OUT_DIR, "manifest.json") | |