From bc08629d292e1383a41e0db254a00a907f42c9e2 Mon Sep 17 00:00:00 2001 From: Fabio Lissi Date: Mon, 12 Oct 2026 18:35:48 -0500 Subject: [PATCH] Batch: subfolders, open documents, file naming, stop on error, error log, progress and cancel (#219) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit File › Automate › Batch now covers Photoshop's dialog (AUTO-219-5): - Source: a folder with Include All Subfolders (the output mirrors the folder tree, so same-named files in different subfolders don't collide), or the open documents (`"source": "open"`: the steps run on every open document as history steps; with an output folder a copy of each is saved there). - File Naming: a template with Photoshop's fields as tokens: {name} {NAME} {Name}, {serial} to {serial:4} from startSerial, {letter} {LETTER}, {date:mmddyy|mmdd|yyyymmdd|yymmdd|yyddmm|ddmmyy}, {ext} {EXT}, other text literal. Default {name}.{ext}, the old naming. - Errors: stopOnError stops at the first failing file and reports the skipped ones; errorLog writes the failures to a text file. - The command runs as a job: the status bar shows "n of total: file" and Cancel stops after the current file. The options live in the new engine module `batch` and are shared by Image Processor, the Lens Correction batch and the CLI's `batch` (--recursive --naming --start-serial --stop-on-error --error-log). The generic form dialog takes an `__order` hint so the Batch dialog is grouped as Photoshop's (Play, Source, Destination, Errors). chrono (clock, native only) supplies the local date for the date tokens. Tests: 9 in batch/tests.rs (tokens and rejected templates, recursive listing, mirrored output, stop/skip/log, cancelled context, background job, open-documents source), one CLI test, one form-order test. The batch_export_options helpers pick the nearest field on a label's row, since the taller dialog's Quality row now shares a height with the Layers panel's opacity field. Scorecard AUTO-219-5 done; gaps, parity and development docs updated. --- Cargo.lock | 1 + apps/photocraft-cli/src/lib.rs | 146 +++++++- crates/engine/Cargo.toml | 2 + crates/engine/src/batch.rs | 338 +++++++++++++++++++ crates/engine/src/batch/tests.rs | 248 ++++++++++++++ crates/engine/src/file_cmds.rs | 213 ++++++++++-- crates/engine/src/lens_cmds.rs | 8 +- crates/engine/src/lib.rs | 1 + crates/ui-egui/src/view_cmds.rs | 38 ++- crates/ui-egui/tests/batch_export_options.rs | 8 +- docs/development.md | 2 +- docs/gaps.md | 17 +- docs/scorecard.md | 4 +- docs/target-app-parity.md | 3 +- scorecard/automation.toml | 4 +- 15 files changed, 972 insertions(+), 61 deletions(-) create mode 100644 crates/engine/src/batch.rs create mode 100644 crates/engine/src/batch/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 79e7cd895e..3f1564a963 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4360,6 +4360,7 @@ name = "photocraft-engine" version = "0.8.2" dependencies = [ "blake3", + "chrono", "craft-print", "exr", "flate2", diff --git a/apps/photocraft-cli/src/lib.rs b/apps/photocraft-cli/src/lib.rs index 87050381a5..f403365de3 100644 --- a/apps/photocraft-cli/src/lib.rs +++ b/apps/photocraft-cli/src/lib.rs @@ -27,8 +27,13 @@ USAGE: photocraft-cli run ( | --new ) --cmd [--params ] [--cmd …] [--out ] [--format ] [--quality <1-100>] [--tiff-layers] [--tga-bits <24|32>] [--dpx-bits <8|10|12|16>] Open a file, run engine commands in order, save the result. Each --params applies to the preceding --cmd. Prints each command's JSON result. - photocraft-cli batch --actions [--action ] --in --out [--format ] [--quality <1-100>] [--in-place] [--tiff-layers] [--tga-bits <24|32>] [--dpx-bits <8|10|12|16>] - Apply an action list to every image in a directory. A Photoshop Actions file (.atn) is a + photocraft-cli batch --actions [--action ] --in --out [--recursive] [--naming