Working state
parent
cb7c358a93
commit
95f20eb8b7
|
|
@ -8,7 +8,7 @@ from PIL import Image, ImageDraw, ImageFont
|
||||||
|
|
||||||
# Configuration constants
|
# Configuration constants
|
||||||
ODS_PATH = "/home/sebastien/Rust/gestion_classe/Staging/simple_eval.ods"
|
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
|
FONT_PATH = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" # Standard Linux font path
|
||||||
|
|
||||||
def get_rounded_score(score):
|
def get_rounded_score(score):
|
||||||
|
|
@ -100,5 +100,9 @@ if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description="Stamp scores on exam copies.")
|
parser = argparse.ArgumentParser(description="Stamp scores on exam copies.")
|
||||||
parser.add_argument("dir", type=Path, help="Root directory containing 'A Rendre' folder")
|
parser.add_argument("dir", type=Path, help="Root directory containing 'A Rendre' folder")
|
||||||
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
OUTPUT_DIR = OUTPUT_DIR / args.dir
|
||||||
|
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
process_images(args.dir)
|
process_images(args.dir)
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ import annotating_with_checks
|
||||||
|
|
||||||
# Roughly 10 A4 pages at 100 DPI
|
# Roughly 10 A4 pages at 100 DPI
|
||||||
MAX_HEIGHT_PX = 11690
|
MAX_HEIGHT_PX = 11690
|
||||||
|
# MAX_HEIGHT_PX = 18000
|
||||||
|
# MAX_HEIGHT_PX = 16000
|
||||||
|
|
||||||
def render_item(item):
|
def render_item(item):
|
||||||
student_id, label, content = item
|
student_id, label, content = item
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ def main():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
work_dir = os.path.abspath(sys.argv[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")
|
target_subdir = os.path.join(work_dir, "A Rendre")
|
||||||
|
|
||||||
os.makedirs(target_subdir, exist_ok=True)
|
os.makedirs(target_subdir, exist_ok=True)
|
||||||
|
|
@ -56,6 +56,7 @@ def main():
|
||||||
# Fallback to Anot
|
# Fallback to Anot
|
||||||
elif (os.path.exists(os.path.join(path_a, "Concat.jpg")) and
|
elif (os.path.exists(os.path.join(path_a, "Concat.jpg")) and
|
||||||
os.path.exists(os.path.join(path_a, "score.json"))):
|
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
|
source_folder = path_a
|
||||||
|
|
||||||
if not source_folder:
|
if not source_folder:
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,6 @@ INPUT_DIR = str(arg_path)
|
||||||
if not arg_path.exists():
|
if not arg_path.exists():
|
||||||
sys.exit(f"Directory {INPUT_DIR} not found.")
|
sys.exit(f"Directory {INPUT_DIR} not found.")
|
||||||
|
|
||||||
import ftfy
|
|
||||||
import ftfy
|
|
||||||
|
|
||||||
clean = ftfy.fix_text(text.replace("\x00", ""))
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import ftfy
|
import ftfy
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,12 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import ezodf
|
import ezodf
|
||||||
|
import re
|
||||||
from pathlib import Path
|
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
|
# Configuration
|
||||||
ODS_PATH = "/home/sebastien/Rust/gestion_classe/Staging/current_eval.ods"
|
ODS_PATH = "/home/sebastien/Rust/gestion_classe/Staging/current_eval.ods"
|
||||||
TARGET_DIR_NAME = "A Rendre"
|
TARGET_DIR_NAME = "A Rendre"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue