[niepce] rust: Use Exempi 2.6.0 (git)
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] rust: Use Exempi 2.6.0 (git)
- Date: Tue, 18 Feb 2020 05:44:09 +0000 (UTC)
commit aafd890e54ce4ec8bb2f321ea3024f7fb48ff5af
Author: Hubert Figuière <hub figuiere net>
Date: Sun Feb 16 19:08:49 2020 -0500
rust: Use Exempi 2.6.0 (git)
- Fix for API changes
- This remove an indirect duplicate incompatible bitflags
Cargo.lock | 24 +++++++----------
crates/npc-engine/Cargo.toml | 2 +-
crates/npc-engine/src/db/libmetadata.rs | 22 +++++++--------
crates/npc-fwk/Cargo.toml | 2 +-
crates/npc-fwk/src/utils/exempi.rs | 48 ++++++++++++++++++---------------
crates/npc-fwk/src/utils/exiv2.rs | 22 +++++++--------
6 files changed, 59 insertions(+), 61 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index 57c0dfc..2b9f915 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -78,11 +78,6 @@ dependencies = [
"which 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
-[[package]]
-name = "bitflags"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
[[package]]
name = "bitflags"
version = "1.2.1"
@@ -209,18 +204,18 @@ dependencies = [
[[package]]
name = "exempi"
-version = "2.5.0"
-source =
"git+https://github.com/hfiguiere/exempi-rs.git?rev=53cfc05#53cfc0527a3644a8b1a04af811bf0672c49b41e7"
+version = "2.6.0"
+source =
"git+https://github.com/hfiguiere/exempi-rs.git?rev=99e8ba5#99e8ba58318d693bdc7aecce1ca6375a3e11d89f"
dependencies = [
- "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "exempi-sys 2.5.0 (git+https://github.com/hfiguiere/exempi-rs.git?rev=53cfc05)",
+ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "exempi-sys 2.5.0 (git+https://github.com/hfiguiere/exempi-rs.git?rev=99e8ba5)",
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "exempi-sys"
version = "2.5.0"
-source =
"git+https://github.com/hfiguiere/exempi-rs.git?rev=53cfc05#53cfc0527a3644a8b1a04af811bf0672c49b41e7"
+source =
"git+https://github.com/hfiguiere/exempi-rs.git?rev=99e8ba5#99e8ba58318d693bdc7aecce1ca6375a3e11d89f"
dependencies = [
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -619,7 +614,7 @@ dependencies = [
"bindgen 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cbindgen 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "exempi 2.5.0 (git+https://github.com/hfiguiere/exempi-rs.git?rev=53cfc05)",
+ "exempi 2.6.0 (git+https://github.com/hfiguiere/exempi-rs.git?rev=99e8ba5)",
"gdk-pixbuf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -637,7 +632,7 @@ dependencies = [
"cairo-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cbindgen 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "exempi 2.5.0 (git+https://github.com/hfiguiere/exempi-rs.git?rev=53cfc05)",
+ "exempi 2.6.0 (git+https://github.com/hfiguiere/exempi-rs.git?rev=99e8ba5)",
"gdk 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1112,7 +1107,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" =
"d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
"checksum bindgen 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)" =
"99de13bb6361e01e493b3db7928085dcc474b7ba4f5481818e53a89d76b8393f"
-"checksum bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"4f67931368edf3a9a51d29886d245f1c3db2f1ef0dcc9e35ff70341b78c10d23"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" =
"cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" =
"214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb"
"checksum cairo-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"0b528aca2ef1026235d0122495dbaee0b09479f77c51f6df8d9bb9cb1c6d6f87"
@@ -1126,8 +1120,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" =
"ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" =
"44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
-"checksum exempi 2.5.0 (git+https://github.com/hfiguiere/exempi-rs.git?rev=53cfc05)" = "<none>"
-"checksum exempi-sys 2.5.0 (git+https://github.com/hfiguiere/exempi-rs.git?rev=53cfc05)" = "<none>"
+"checksum exempi 2.6.0 (git+https://github.com/hfiguiere/exempi-rs.git?rev=99e8ba5)" = "<none>"
+"checksum exempi-sys 2.5.0 (git+https://github.com/hfiguiere/exempi-rs.git?rev=99e8ba5)" = "<none>"
"checksum futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" =
"f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8"
"checksum futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" =
"f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a"
"checksum futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" =
"f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba"
diff --git a/crates/npc-engine/Cargo.toml b/crates/npc-engine/Cargo.toml
index 703388e..b60d290 100644
--- a/crates/npc-engine/Cargo.toml
+++ b/crates/npc-engine/Cargo.toml
@@ -9,7 +9,7 @@ build = "build.rs"
[dependencies]
chrono = "0.4.0"
-exempi = { version = "2.5.0", git = "https://github.com/hfiguiere/exempi-rs.git", rev="53cfc05" }
+exempi = { version = "2.6.0", git = "https://github.com/hfiguiere/exempi-rs.git", rev="99e8ba5" }
gdk-pixbuf-sys = "*"
gdk-pixbuf = "*"
glib = "*"
diff --git a/crates/npc-engine/src/db/libmetadata.rs b/crates/npc-engine/src/db/libmetadata.rs
index 77fa771..0911bc5 100644
--- a/crates/npc-engine/src/db/libmetadata.rs
+++ b/crates/npc-engine/src/db/libmetadata.rs
@@ -86,12 +86,12 @@ impl LibMetadata {
fn get_metadata(&self, meta: Np) -> Option<PropertyValue> {
let index_to_xmp = try_opt!(property_index_to_xmp(meta));
- let mut prop_flags = exempi::PROP_NONE;
+ let mut prop_flags = exempi::PropFlags::default();
let mut xmp_result =
self.xmp
.xmp
.get_property(&index_to_xmp.ns, &index_to_xmp.property, &mut prop_flags);
- if xmp_result.is_ok() && prop_flags.contains(exempi::ARRAY_IS_ALTTEXT) {
+ if xmp_result.is_ok() && prop_flags.contains(exempi::PropFlags::ARRAY_IS_ALTTEXT) {
if let Ok((_, value)) = self.xmp.xmp.get_localized_text(
&index_to_xmp.ns,
&index_to_xmp.property,
@@ -117,7 +117,7 @@ impl LibMetadata {
return self
.xmp
.xmp
- .set_property_i32(&ix.ns, &ix.property, i, exempi::PROP_NONE)
+ .set_property_i32(&ix.ns, &ix.property, i, exempi::PropFlags::NONE)
.is_ok()
}
PropertyValue::String(ref s) => {
@@ -126,7 +126,7 @@ impl LibMetadata {
} else if self
.xmp
.xmp
- .set_property(&ix.ns, &ix.property, s, exempi::PROP_NONE)
+ .set_property(&ix.ns, &ix.property, s, exempi::PropFlags::NONE)
.is_err()
{
if exempi::get_error() == exempi::Error::BadXPath {
@@ -139,7 +139,7 @@ impl LibMetadata {
"",
"x-default",
s,
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
)
.is_ok();
}
@@ -159,9 +159,9 @@ impl LibMetadata {
.append_array_item(
&ix.ns,
&ix.property,
- exempi::PROP_VALUE_IS_ARRAY,
+ exempi::PropFlags::VALUE_IS_ARRAY,
s,
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
)
.is_err()
{
@@ -176,7 +176,7 @@ impl LibMetadata {
return self
.xmp
.xmp
- .set_property_date(&ix.ns, &ix.property, &xmp_date, exempi::PROP_NONE)
+ .set_property_date(&ix.ns, &ix.property, &xmp_date, exempi::PropFlags::NONE)
.is_ok();
}
}
@@ -221,13 +221,13 @@ impl LibMetadata {
&self.xmp.xmp,
NS_DC,
"subject",
- exempi::ITER_JUST_LEAF_NODES,
+ exempi::IterFlags::JUST_LEAF_NODES,
);
let mut keywords: Vec<String> = vec![];
let mut schema = exempi::XmpString::new();
let mut name = exempi::XmpString::new();
let mut value = exempi::XmpString::new();
- let mut flags = exempi::PropFlags::empty();
+ let mut flags = exempi::PropFlags::default();
while iter.next(&mut schema, &mut name, &mut value, &mut flags) {
keywords.push(String::from(value.to_str()));
}
@@ -270,7 +270,7 @@ impl LibMetadata {
let xmpdate = xmp_date_from(&Utc::now());
self.xmp
.xmp
- .set_property_date(NS_XAP, "MetadataDate", &xmpdate, exempi::PROP_NONE)
+ .set_property_date(NS_XAP, "MetadataDate", &xmpdate, exempi::PropFlags::NONE)
.is_ok()
}
}
diff --git a/crates/npc-fwk/Cargo.toml b/crates/npc-fwk/Cargo.toml
index 6fc3d5a..d9d035c 100644
--- a/crates/npc-fwk/Cargo.toml
+++ b/crates/npc-fwk/Cargo.toml
@@ -10,7 +10,7 @@ build = "build.rs"
[dependencies]
cairo-rs = "*"
chrono = "0.4.0"
-exempi = { version = "2.5.0", git = "https://github.com/hfiguiere/exempi-rs.git", rev="53cfc05" }
+exempi = { version = "2.6.0", git = "https://github.com/hfiguiere/exempi-rs.git", rev="99e8ba5" }
gio-sys = "*"
gio = "^0.8.0"
glib-sys = "*"
diff --git a/crates/npc-fwk/src/utils/exempi.rs b/crates/npc-fwk/src/utils/exempi.rs
index 4d27623..8c0d1b0 100644
--- a/crates/npc-fwk/src/utils/exempi.rs
+++ b/crates/npc-fwk/src/utils/exempi.rs
@@ -93,31 +93,31 @@ impl Flash {
ns,
&format!("{}/exif:Fired", property),
bool_to_propstring(self.fired),
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
)?;
xmp.set_property(
ns,
&format!("{}/exif:Return", property),
&format!("{}", self.rturn),
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
)?;
xmp.set_property(
ns,
&format!("{}/exif:Mode", property),
&format!("{}", self.mode),
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
)?;
xmp.set_property(
ns,
&format!("{}/exif:Function", property),
bool_to_propstring(self.function),
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
)?;
xmp.set_property(
ns,
&format!("{}/exif:RedEyeMode", property),
bool_to_propstring(self.red_eye),
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
)?;
Ok(())
@@ -185,7 +185,7 @@ impl XmpMeta {
let mut meta: Option<XmpMeta> = None;
if !sidecar_only {
if let Ok(xmpfile) =
- exempi::XmpFile::open_new(&*file.to_string_lossy(), exempi::OPEN_READ)
+ exempi::XmpFile::open_new(&*file.to_string_lossy(), exempi::OpenFlags::READ)
{
meta = match xmpfile.get_new_xmp() {
Ok(xmp) => Some(Self::new_with_xmp(xmp)),
@@ -251,21 +251,21 @@ impl XmpMeta {
}
// Properties in source but not in destination gets copied over.
- let mut iter = exempi::XmpIterator::new(&self.xmp, "", "", exempi::ITER_PROPERTIES);
+ let mut iter = exempi::XmpIterator::new(&self.xmp, "", "", exempi::IterFlags::PROPERTIES);
{
use exempi::XmpString;
let mut schema = XmpString::new();
let mut name = XmpString::new();
let mut value = XmpString::new();
- let mut option = exempi::PROP_NONE;
+ let mut option = exempi::PropFlags::default();
while iter.next(&mut schema, &mut name, &mut value, &mut option) {
if name.to_str().is_empty() {
continue;
}
- if option.contains(exempi::PROP_VALUE_IS_ARRAY)
- || option.contains(exempi::PROP_VALUE_IS_STRUCT)
+ if option.contains(exempi::PropFlags::VALUE_IS_ARRAY)
+ || option.contains(exempi::PropFlags::VALUE_IS_STRUCT)
{
- iter.skip(exempi::ITER_SKIP_SUBTREE);
+ iter.skip(exempi::IterSkipFlags::SUBTREE);
continue;
}
@@ -276,7 +276,7 @@ impl XmpMeta {
schema.to_str(),
name.to_str(),
value.to_str(),
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
)
.is_err()
{
@@ -290,7 +290,7 @@ impl XmpMeta {
pub fn serialize_inline(&self) -> String {
if let Ok(xmpstr) = self.xmp.serialize_and_format(
- exempi::SERIAL_OMITPACKETWRAPPER | exempi::SERIAL_OMITALLFORMATTING,
+ exempi::SerialFlags::OMITPACKETWRAPPER | exempi::SerialFlags::OMITALLFORMATTING,
0,
"",
"",
@@ -305,7 +305,7 @@ impl XmpMeta {
pub fn serialize(&self) -> String {
if let Ok(xmpstr) =
self.xmp
- .serialize_and_format(exempi::SERIAL_OMITPACKETWRAPPER, 0, "\n", "", 0)
+ .serialize_and_format(exempi::SerialFlags::OMITPACKETWRAPPER, 0, "\n", "", 0)
{
let buf = String::from(xmpstr.to_str());
return buf;
@@ -318,20 +318,20 @@ impl XmpMeta {
}
pub fn orientation(&self) -> Option<i32> {
- let mut flags: exempi::PropFlags = exempi::PropFlags::empty();
+ let mut flags: exempi::PropFlags = exempi::PropFlags::default();
self.xmp
.get_property_i32(NS_TIFF, "Orientation", &mut flags)
.ok()
}
pub fn label(&self) -> Option<String> {
- let mut flags: exempi::PropFlags = exempi::PROP_NONE;
+ let mut flags: exempi::PropFlags = exempi::PropFlags::default();
let xmpstring = try_opt!(self.xmp.get_property(NS_XAP, "Label", &mut flags).ok());
Some(String::from(xmpstring.to_str()))
}
pub fn rating(&self) -> Option<i32> {
- let mut flags: exempi::PropFlags = exempi::PROP_NONE;
+ let mut flags: exempi::PropFlags = exempi::PropFlags::default();
self.xmp.get_property_i32(NS_XAP, "Rating", &mut flags).ok()
}
@@ -343,7 +343,7 @@ impl XmpMeta {
}
pub fn creation_date(&self) -> Option<DateTime<Utc>> {
- let mut flags: exempi::PropFlags = exempi::PropFlags::empty();
+ let mut flags: exempi::PropFlags = exempi::PropFlags::default();
let xmpstring = try_opt!(self
.xmp
.get_property(NS_EXIF, "DateTimeOriginal", &mut flags)
@@ -365,7 +365,7 @@ impl XmpMeta {
/// Get the date property and return a Option<DateTime<Utc>> parsed
/// from the string value.
pub fn get_date_property(&self, ns: &str, property: &str) -> Option<DateTime<Utc>> {
- let mut flags: exempi::PropFlags = exempi::PropFlags::empty();
+ let mut flags: exempi::PropFlags = exempi::PropFlags::default();
let property = self.xmp.get_property(ns, property, &mut flags);
if property.is_err() {
err_out!("Error getting date property {:?}", property.err());
@@ -389,12 +389,16 @@ impl XmpMeta {
if !self.keywords_fetched {
use exempi::XmpString;
- let mut iter =
- exempi::XmpIterator::new(&self.xmp, NS_DC, "subject", exempi::ITER_JUST_LEAF_NODES);
+ let mut iter = exempi::XmpIterator::new(
+ &self.xmp,
+ NS_DC,
+ "subject",
+ exempi::IterFlags::JUST_LEAF_NODES,
+ );
let mut schema = XmpString::new();
let mut name = XmpString::new();
let mut value = XmpString::new();
- let mut option = exempi::PROP_NONE;
+ let mut option = exempi::PropFlags::default();
while iter.next(&mut schema, &mut name, &mut value, &mut option) {
self.keywords.push(String::from(value.to_str()));
}
diff --git a/crates/npc-fwk/src/utils/exiv2.rs b/crates/npc-fwk/src/utils/exiv2.rs
index 7b2aed3..0ad292b 100644
--- a/crates/npc-fwk/src/utils/exiv2.rs
+++ b/crates/npc-fwk/src/utils/exiv2.rs
@@ -282,7 +282,7 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
xmp_prop.0,
xmp_prop.1,
&s,
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
) {
err_out!(
"Error setting property {} {}: {:?}",
@@ -298,7 +298,7 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
xmp_prop.0,
xmp_prop.1,
&d,
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
) {
err_out!(
"Error setting property {} {}: {:?}",
@@ -345,7 +345,7 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
xmp_prop.0,
xmp_prop.1,
value,
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
) {
err_out!(
"Error setting property {} {}: {:?}",
@@ -361,7 +361,7 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
xmp_prop.0,
xmp_prop.1,
&value,
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
) {
err_out!(
"Error setting property {} {}: {:?}",
@@ -383,7 +383,7 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
xmp_prop.0,
xmp_prop.1,
value,
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
) {
err_out!(
"Error setting property {} {}: {:?}",
@@ -403,7 +403,7 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
xmp_prop.0,
xmp_prop.1,
&value,
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
) {
err_out!(
"Error setting property {} {}: {:?}",
@@ -421,7 +421,7 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
xmp_prop.0,
xmp_prop.1,
&value_str,
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
) {
err_out!(
"Error setting property {} {}: {:?}",
@@ -439,7 +439,7 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
xmp_prop.0,
xmp_prop.1,
&value,
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
) {
err_out!(
"Error setting property {} {}: {:?}",
@@ -457,7 +457,7 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
xmp_prop.0,
xmp_prop.1,
&value,
- exempi::PROP_NONE,
+ exempi::PropFlags::NONE,
) {
err_out!(
"Error setting property {} {}: {:?}",
@@ -481,10 +481,10 @@ pub fn xmp_from_exiv2<S: AsRef<OsStr>>(file: S) -> Option<XmpMeta> {
}
meta.get_gps_info();
- let mut options = exempi::PROP_NONE;
+ let mut options = exempi::PropFlags::default();
if let Ok(date) = xmp.get_property_date(NS_XAP, "ModifyDate", &mut options) {
if let Err(err) =
- xmp.set_property_date(NS_XAP, "MetadataDate", &date, exempi::PROP_NONE)
+ xmp.set_property_date(NS_XAP, "MetadataDate", &date, exempi::PropFlags::NONE)
{
err_out!("Error setting MetadataDate: {:?}", &err);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]