Keep colour labels in the sidecar so they survive and travel
A rating and a flag are written to DarkRoom's sidecar as well as the catalog, because the catalog is a disposable index and the sidecar is how a judgement reaches the photographer's other devices. A label had no place there, so once labels could be set, one would have lived only in the catalog of the device it was set on and gone with it. The sidecar version now carries `label` (0 none, 1-5 as the catalog codes it), written only when set. It merges under the rating's rule, so a device that never labelled a frame cannot clear another device's label, and a code this build does not know reads as none rather than as some other colour. A judgement write carries the catalog's label with the stars, and the scan takes a sidecar's label into the catalog when it has one. An older build keeps the line as an unknown key and writes it back.
This commit is contained in:
@@ -34,8 +34,8 @@ pub struct SidecarWrite {
|
||||
/// amendment rather than a replacement.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Amendment {
|
||||
/// A star rating and a pick/reject flag — the cull.
|
||||
Judgement { rating: u8, flag: u8 },
|
||||
/// A star rating, a pick/reject flag and a colour label — the cull.
|
||||
Judgement { rating: u8, flag: u8, label: u8 },
|
||||
/// TRACES: FR-DEV-6
|
||||
/// Copied develop settings, applied within `scope`.
|
||||
///
|
||||
@@ -302,9 +302,14 @@ pub(super) fn amend(base: dr_pipeline::Sidecar, w: &SidecarWrite) -> dr_pipeline
|
||||
// paste must spare, the unknown keys of an operation this build lacks —
|
||||
// survives because it was read from the file and is written back.
|
||||
match &w.amendment {
|
||||
Amendment::Judgement { rating, flag } => {
|
||||
Amendment::Judgement {
|
||||
rating,
|
||||
flag,
|
||||
label,
|
||||
} => {
|
||||
version.rating = *rating;
|
||||
version.flag = *flag;
|
||||
version.label = *label;
|
||||
}
|
||||
Amendment::Settings {
|
||||
preset,
|
||||
@@ -624,7 +629,11 @@ mod tests {
|
||||
SidecarWrite {
|
||||
image_path: "PhotosRaw/incoming/a.CR2".to_string(),
|
||||
version_uuid: uuid.to_string(),
|
||||
amendment: Amendment::Judgement { rating, flag: 0 },
|
||||
amendment: Amendment::Judgement {
|
||||
rating,
|
||||
flag: 0,
|
||||
label: 0,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user