[niepce] fwk/exiv2: handle old Nikon lens type
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] fwk/exiv2: handle old Nikon lens type
- Date: Sun, 17 Feb 2019 15:14:32 +0000 (UTC)
commit 66e44a3b3d43181824e4a9b523f49f0de26affae
Author: Hubert Figuière <hub figuiere net>
Date: Tue Jan 1 00:28:02 2019 -0500
fwk/exiv2: handle old Nikon lens type
src/fwk/utils/exiv2.rs | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/src/fwk/utils/exiv2.rs b/src/fwk/utils/exiv2.rs
index faaf38f..897dd27 100644
--- a/src/fwk/utils/exiv2.rs
+++ b/src/fwk/utils/exiv2.rs
@@ -1,7 +1,7 @@
/*
* niepce - fwk/utils/exiv2.rs
*
- * Copyright (C) 2018 Hubert Figuière
+ * Copyright (C) 2018-2019 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -94,6 +94,9 @@ lazy_static! {
("Exif.Minolta.LensID", (NS_AUX, "Lens", Conversion::Interpreted)),
("Exif.Minolta.LensID", (NS_EXIF_EX, "LensModel", Conversion::Interpreted)),
+ ("Exif.Nikon3.Lens", (NS_AUX, "Lens", Conversion::Interpreted)),
+ ("Exif.Nikon3.Lens", (NS_EXIF_EX, "LensModel", Conversion::Interpreted)),
+
("Exif.OlympusEq.LensModel", (NS_AUX, "Lens", Conversion::None)),
("Exif.OlympusEq.LensModel", (NS_EXIF_EX, "LensModel", Conversion::None)),
("Exif.OlympusEq.LensSerialNumber", (NS_EXIF_EX, "LensSerialNumber", Conversion::None)),
@@ -209,11 +212,20 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
},
Ok(rexiv2::TagType::UnsignedRational) |
Ok(rexiv2::TagType::SignedRational) => {
- if let Some(value) = meta.get_tag_rational(&tag) {
- let value_str = format!("{}/{}", value.numer(), value.denom());
- if let Err(err) = xmp.set_property(xmp_prop.0, xmp_prop.1, &value_str,
exempi::PROP_NONE) {
- err_out!("Error setting property {} {}: {:?}", &xmp_prop.0, &xmp_prop.1,
&err);
- }
+ match xmp_prop.2 {
+ Conversion::Interpreted => {
+ if let Ok(value) = meta.get_tag_interpreted_string(&tag) {
+ if let Err(err) = xmp.set_property(xmp_prop.0, xmp_prop.1, &value,
exempi::PROP_NONE) {
+ err_out!("Error setting property {} {}: {:?}", &xmp_prop.0,
&xmp_prop.1, &err);
+ }
+ }
+ },
+ _ => if let Some(value) = meta.get_tag_rational(&tag) {
+ let value_str = format!("{}/{}", value.numer(), value.denom());
+ if let Err(err) = xmp.set_property(xmp_prop.0, xmp_prop.1, &value_str,
exempi::PROP_NONE) {
+ err_out!("Error setting property {} {}: {:?}", &xmp_prop.0,
&xmp_prop.1, &err);
+ }
+ },
}
},
Ok(rexiv2::TagType::Comment) => {
@@ -241,7 +253,7 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
}
}
} else {
- err_out!("Unknown property {}", &tag);
+// err_out!("Unknown property {}", &tag);
}
}
meta.get_gps_info();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]