#[arg(short = 'n', long)]
dry_run: bool,
+ /// Skip files that have already been processed by pww
+ #[arg(short = 's', long)]
+ skip_processed: bool,
+
/// Print information about which tags are written
#[arg(short = 'v', long)]
verbose: bool,
/// Directory to store temporary files
temp_dir: Option<PathBuf>,
+ /// Skip files that have already been processed by pww
+ skip_processed: bool,
+
/// Policy for which metadata should be updated
file_update_policy: FileUpdatePolicy,
self.cli.as_ref().map(|c| c.dry_run).unwrap_or_default()
}
+ fn skip_processed(&self) -> bool {
+ self.cli.as_ref().map(|c| c.skip_processed).unwrap_or_default()
+ }
+
fn verbose(&self) -> bool {
self.cli.as_ref().map(|c| c.verbose).unwrap_or_default()
}
identifier_bin: None,
identifier_bin_args: vec!(),
temp_dir: None,
+ skip_processed: false,
file_update_policy: FileUpdatePolicy::SidecarOnly,
tag_update_policy: TagUpdatePolicy::ReplacePrefixed,
tag_prefix: Some("[ML] ".to_owned()),
// Check sidecar file before analysis because it's a common error
// and we might as well not waste time analyzing when the tags
// won't be writeable.
- let _ = should_update_sidecar(&config, &input_path)?;
+ let metafile = match should_update_sidecar(&config, &input_path)? {
+ Some(p) => p,
+ None => input_path.to_owned(),
+ };
+
+ // Check the metadata to see if this file has already been
+ // processed, and skip it if configured to do so.
+ let _ = rexiv2::register_xmp_namespace("pww", "photo-what-what");
+ let meta = rexiv2::Metadata::new_from_path(&metafile)
+ .map_err(|e| PwwError::Unknown(format!("Unable to read metadata from image file: {}", e)))?;
+ if config.skip_processed() && meta.get_tag_numeric("Xmp.photo-what-what.processed") == 1 {
+ if config.verbose() {
+ println!(" - already processed, skipped!")
+ }
+ return Ok(());
+ }
// run ML engine on file
if config.debug() {