diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2018-12-01 12:26:19 -0800 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2018-12-01 12:26:19 -0800 |
| commit | 52beda1aa48f02ebb47b32d6685c394bdd4077e1 (patch) | |
| tree | d4c98ee25b15bd3792385eecd040779dd0fbb22a | |
| parent | 8f33ac391863f4acc5eada1a99642f540db5a334 (diff) | |
| download | plag-52beda1aa48f02ebb47b32d6685c394bdd4077e1.tar.gz plag-52beda1aa48f02ebb47b32d6685c394bdd4077e1.zip | |
Add datetime property
| -rw-r--r-- | src/main.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 1076441..13b77e6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -126,6 +126,7 @@ fn get_longitude(reader: &exif::Reader) -> Result<f64> { enum Property { Filename, Path, + Datetime, } impl std::fmt::Display for Property { @@ -133,6 +134,7 @@ impl std::fmt::Display for Property { match self { Property::Filename => write!(w, "filename"), Property::Path => write!(w, "path"), + Property::Datetime => write!(w, "datetime"), } } } @@ -155,6 +157,10 @@ fn get_feature(filename: &Path, properties: &[Property]) -> Result<Feature> { Property::Path => { let path = filename.canonicalize()?; to_value(path.to_string_lossy()) + }, + Property::Datetime => { + let data = get_string(&reader, exif::Tag::DateTimeOriginal)?; + to_value(data) } }; props.insert(key, value.unwrap()); @@ -196,6 +202,7 @@ fn main() { match prop { "filename" => valid_properties.push(Property::Filename), "path" => valid_properties.push(Property::Path), + "datetime" => valid_properties.push(Property::Datetime), _ => { eprintln!("unknown property: {}", prop); std::process::exit(1); |
