diff --git a/.gitignore b/.gitignore index 2df0763..c6637ef 100644 --- a/.gitignore +++ b/.gitignore @@ -15,27 +15,7 @@ Cargo.lock # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries +.idea/ # Gradle and Maven with auto-import # When using Gradle or Maven with auto-import, you should exclude module files, @@ -53,9 +33,6 @@ Cargo.lock # CMake cmake-build-*/ -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - # File-based project format *.iws diff --git a/BlueSquare.jpg b/BlueSquare.jpg new file mode 100644 index 0000000..81b8a22 Binary files /dev/null and b/BlueSquare.jpg differ diff --git a/Canon_40D.jpg b/Canon_40D.jpg new file mode 100644 index 0000000..6eb33f1 Binary files /dev/null and b/Canon_40D.jpg differ diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..9090ad4 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "curators" +version = "0.1.0" +authors = ["Micha Glave "] +edition = "2018" +exclude = [".travis.yml", ".gitignore", "test-data/**"] +description = "Image Gallery. Defined by plain files." + +[dependencies] +toml = "0.5" +structopt = "0.3" +#exempi = "2.5.0" +strum = "0.18.0" +strum_macros = "0.18.0" +kamadak-exif = "0.5" diff --git a/README.md b/README.md index 998a25c..32db490 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ # curators -Image Gallery. Defined by plain files. \ No newline at end of file +Image Gallery. Defined by plain files. + +## Goal: +Image management for multiple (competing) users. Purely file-based, non-destructive, based on standards (as much as possible). Using + +* [Exif](https://de.wikipedia.org/wiki/Exchangeable_Image_File_Format) +* [IPTC](https://de.wikipedia.org/wiki/IPTC-IIM-Standard) +* [XMP](https://de.wikipedia.org/wiki/Extensible_Metadata_Platform) diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..1114aa6 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,51 @@ +extern crate strum; + +use structopt::StructOpt; +use strum_macros::EnumString; + +#[derive(EnumString, Debug)] +enum Cmd { + #[strum(serialize = "read", serialize = "r")] + Read, + #[strum( + serialize = "write", + serialize = "w", + serialize = "set", + serialize = "s" + )] + Write, +} + +#[derive(Debug, StructOpt)] +#[structopt(name = "curators", about = "An image meta-data handling tool.")] +struct Opt { + /// image-file to work with. + image_file: String, + + /// operation + cmd: Option, + + /// Property to handle. + property: Option, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); + + match std::fs::File::open(&opt.image_file) { + Ok(file) => { + let mut bufreader = std::io::BufReader::new(&file); + let exifreader = exif::Reader::new(); + match exifreader.read_from_container(&mut bufreader) { + Ok(exif) => { + for f in exif.fields() { + println!("{}: {}", f.tag, f.display_value().with_unit(&exif)); + } + } + Err(e) => println!("{:?}", e), + } + } + Err(e) => println!("{:?}", e), + } +}