Skip to content

Commit

Permalink
fix(exif): Doesn't recognize DateTimeOriginal tag in file. #33
Browse files Browse the repository at this point in the history
  • Loading branch information
mindeng committed Jan 15, 2025
1 parent 157ff1a commit 8a88f30
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
24 changes: 13 additions & 11 deletions src/exif/exif_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,13 @@ impl ParsedExifEntry {
}
}

fn make_err(ifd: usize, tag: ExifTagCode, e: ParseEntryError) -> Self {
Self {
ifd,
tag,
res: Some(Err(EntryError(e))),
}
}
// fn make_err(ifd: usize, tag: ExifTagCode, e: ParseEntryError) -> Self {
// Self {
// ifd,
// tag,
// res: Some(Err(EntryError(e))),
// }
// }
}

impl Debug for ParsedExifEntry {
Expand Down Expand Up @@ -379,7 +379,7 @@ impl Iterator for ExifIter {
let cur_ifd_idx = ifd.ifd_idx;
match ifd.next() {
Some((tag_code, entry)) => {
// tracing::debug!(ifd = ifd.ifd_idx, ?tag_code, ?entry, "next tag entry");
tracing::debug!(ifd = ifd.ifd_idx, ?tag_code, ?entry, "next tag entry");

match entry {
IfdEntry::IfdNew(new_ifd) => {
Expand Down Expand Up @@ -425,9 +425,11 @@ impl Iterator for ExifIter {
}
IfdEntry::Err(e) => {
tracing::warn!(?tag_code, ?e, "parse ifd entry error");
let res =
Some(ParsedExifEntry::make_err(ifd.ifd_idx, tag_code.unwrap(), e));
return res;
// let res =
// Some(ParsedExifEntry::make_err(ifd.ifd_idx, tag_code.unwrap(), e));
// return res;
self.ifds.push(ifd);
continue;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub enum EntryValue {
URationalArray(Vec<URational>),
IRationalArray(Vec<IRational>),

U8Array(Vec<u8>),
U16Array(Vec<u16>),
U32Array(Vec<u32>),
}
Expand Down Expand Up @@ -161,9 +162,7 @@ impl EntryValue {
match data_format {
DataFormat::U8 => match components_num {
1 => Ok(Self::U8(data[0])),
x => Err(Error::Unsupported(format!(
"unsigned byte with {x} components"
))),
_ => Ok(Self::U8Array(data.into())),
},
DataFormat::Text => Ok(EntryValue::Text(
get_cstr(data).map_err(|e| Error::InvalidData(e.to_string()))?,
Expand Down Expand Up @@ -468,6 +467,7 @@ impl Display for EntryValue {
EntryValue::IRationalArray(v) => {
format!("IRationalArray[{}]", rationals_to_string::<i32>(v)).fmt(f)
}
EntryValue::U8Array(v) => array_to_string("U8Array", v, f),
EntryValue::U32Array(v) => array_to_string("U32Array", v, f),
EntryValue::U16Array(v) => array_to_string("U16Array", v, f),
}
Expand Down

0 comments on commit 8a88f30

Please sign in to comment.