From 87842d296fde5a5ef60dbff240b047f28ce669b4 Mon Sep 17 00:00:00 2001 From: Antoine Van Elstraete Date: Tue, 10 Feb 2026 16:34:46 +0100 Subject: [PATCH] Correction --set-file-date : applique aussi la date aux fichiers XMP sidecar Co-Authored-By: Claude Opus 4.5 --- json_to_metadata/cli.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/json_to_metadata/cli.py b/json_to_metadata/cli.py index 6e3753c..c0ddb06 100644 --- a/json_to_metadata/cli.py +++ b/json_to_metadata/cli.py @@ -178,6 +178,7 @@ def process_roll( # Écrire les métadonnées write_success = False + xmp_path = None try: if force_xmp: xmp_path = write_xmp_sidecar(image_path, tags, dry_run) @@ -196,6 +197,9 @@ def process_roll( write_success = True success_count += 1 logger.info(f"Frame {frame_id} : métadonnées écrites via {method}") + # Si XMP créé, récupérer le chemin + if method == 'xmp': + xmp_path = image_path.with_suffix('.xmp') else: failure_count += 1 logger.error(f"Frame {frame_id} : échec de l'écriture") @@ -212,6 +216,9 @@ def process_roll( try: frame_date = parse_date(frame['date']) set_file_mtime(image_path, frame_date, dry_run) + # Modifier aussi le fichier XMP sidecar s'il existe + if xmp_path and xmp_path.exists(): + set_file_mtime(xmp_path, frame_date, dry_run) except ValueError as e: logger.warning(f"Date invalide pour le frame {frame_id} : {e}")