apply_ratings_batch
Write darktable ratings to XMP sidecars for a batch of raw photos, updating only the rating value to preserve edit history. Supports -1 to 5 stars and logs each change for audit.
Instructions
Write XMP sidecars (xmp:Rating) for a batch of {stem: rating} pairs. Each sidecar sits next to its raw file at .xmp and is picked up automatically by darktable on import. Rating range: -1 (reject), 0 (unrated), 1-5 (stars). Each rating is also appended to /ratings.jsonl for replay/audit. An existing sidecar is never replaced: only its rating value is rewritten, so darktable edit history survives. A sidecar with no recognisable rating is skipped with an error rather than overwritten.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| log | No | Append entries to ratings.jsonl | |
| force | No | Destructive: replace an existing sidecar wholesale instead of patching its rating. This discards any darktable edit history in that file. Only use when the user has explicitly asked to reset the sidecars. | |
| ratings | Yes | Map of file stem (e.g. 'DSC_1234') to rating int in [-1, 5]. When the same stem occurs in more than one subdirectory the bare stem is rejected as ambiguous — use a source-relative path instead (e.g. 'store_00010001_DCIM_100NCD80/DSC_1234'). | |
| source_dir | Yes | Directory holding the raw files |