Working state

master
Sébastien Miquel 2026-03-10 14:21:35 +01:00
parent cb7c358a93
commit 95f20eb8b7
5 changed files with 13 additions and 7 deletions

View File

@ -8,7 +8,7 @@ from PIL import Image, ImageDraw, ImageFont
# Configuration constants
ODS_PATH = "/home/sebastien/Rust/gestion_classe/Staging/simple_eval.ods"
OUTPUT_DIR = Path("/home/sebastien/Rust/Server/assets/static/copies")
OUTPUT_DIR = Path("/home/sebastien/Rust/Server/copies")
FONT_PATH = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" # Standard Linux font path
def get_rounded_score(score):
@ -100,5 +100,9 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Stamp scores on exam copies.")
parser.add_argument("dir", type=Path, help="Root directory containing 'A Rendre' folder")
args = parser.parse_args()
OUTPUT_DIR = OUTPUT_DIR / args.dir
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
process_images(args.dir)

View File

@ -12,6 +12,8 @@ import annotating_with_checks
# Roughly 10 A4 pages at 100 DPI
MAX_HEIGHT_PX = 11690
# MAX_HEIGHT_PX = 18000
# MAX_HEIGHT_PX = 16000
def render_item(item):
student_id, label, content = item

View File

@ -10,7 +10,7 @@ def main():
sys.exit(1)
work_dir = os.path.abspath(sys.argv[1])
bnot_dir = os.path.abspath(sys.argv[2])
bnot_dir = sys.argv[2]
target_subdir = os.path.join(work_dir, "A Rendre")
os.makedirs(target_subdir, exist_ok=True)
@ -56,6 +56,7 @@ def main():
# Fallback to Anot
elif (os.path.exists(os.path.join(path_a, "Concat.jpg")) and
os.path.exists(os.path.join(path_a, "score.json"))):
print(f"Debug : couldn't find {path_b} falling back to Anot path")
source_folder = path_a
if not source_folder:

View File

@ -15,11 +15,6 @@ INPUT_DIR = str(arg_path)
if not arg_path.exists():
sys.exit(f"Directory {INPUT_DIR} not found.")
import ftfy
import ftfy
clean = ftfy.fix_text(text.replace("\x00", ""))
import json
import ftfy

View File

@ -2,8 +2,12 @@ import os
import sys
import json
import ezodf
import re
from pathlib import Path
def natural_key(text):
return [int(c) if c.isdigit() else c.lower() for c in re.split(r'(\d+)', str(text))]
# Configuration
ODS_PATH = "/home/sebastien/Rust/gestion_classe/Staging/current_eval.ods"
TARGET_DIR_NAME = "A Rendre"