-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
99 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
use chrono::{DateTime, Utc}; | ||
use std::path::Path; | ||
|
||
pub fn write_tag(path: &Path, dateTag: DateTime<Utc>) -> Result<(), String> { | ||
//let file = File::open(i.path()).unwrap(); | ||
//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.ifd_num.index(), | ||
// // f.tag, | ||
// // f.display_value().with_unit(&exif) | ||
// // ); | ||
// // println!(" {:?}", f.value); | ||
// //} | ||
// // To parse a DateTime-like field, `DateTime::from_ascii` can be used. | ||
// if let Some(field) = exif.get_field(Tag::DateTime, In::PRIMARY) { | ||
// match field.value { | ||
// Value::Ascii(ref vec) if !vec.is_empty() => { | ||
// if let Ok(datetime) = DateTime::from_ascii(&vec[0]) { | ||
// println!("Year of DateTime is {}.", datetime.year); | ||
// } | ||
// } | ||
// _ => {} | ||
// } | ||
// } | ||
// } | ||
// Err(e) => match &e { | ||
// exif::Error::NotFound(msg) => println!("No Exif data found: {msg:?}"), | ||
// other_error => println!("error parsing metadata: {other_error:?}"), | ||
// }, | ||
//} | ||
// | ||
//let exif = exifreader.read_from_container(&mut bufreader).unwrap(); | ||
|
||
//match Metadata::new_from_path(i.path()) { | ||
// Ok(metadata) => { | ||
// println!("=== HELLO!"); | ||
// for tag in metadata.data() { | ||
// println!("{:?}", tag); | ||
// } | ||
// } | ||
// Err(e) => println!("error parsing metadata: {e:?}"), | ||
//} | ||
|
||
//match p.captures(i.file_name().to_str().unwrap()) { | ||
// None => { | ||
// s.num_skipped_files += 1; | ||
// s.skipped_files | ||
// .push(String::from(i.path().to_str().unwrap())); | ||
// } | ||
// Some(date_time) => { | ||
// s.num_parsed_files += 1; | ||
// let mtime = FileTime::from_unix_time(date_time.timestamp(), 0); | ||
// set_file_mtime(i.path().to_str().unwrap(), mtime).unwrap(); | ||
// } | ||
//} | ||
return Ok(()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters