Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Sep 23, 2024
1 parent 290cf65 commit b4a800f
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 3 deletions.
48 changes: 48 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ regex = "1.10"
chrono = "0.4.34"
filetime = "0.2"
kamadak-exif = "0.5.5"
little_exif = "0.4.0"
15 changes: 13 additions & 2 deletions src/datetime_tag_writer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
use chrono::{DateTime, Utc};
use little_exif::exif_tag::ExifTag;
use little_exif::metadata::Metadata;
use std::path::Path;

pub fn write_tag(path: &Path, dateTag: DateTime<Utc>) -> Result<(), String> {
return Ok(());
pub fn write_tag(path: &Path, date_tag: DateTime<Utc>) -> Result<(), String> {
let mut metadata = match Metadata::new_from_path(path) {
Ok(metadata) => metadata,
Err(e) => return Err(e.to_string()),
};

metadata.set_tag(ExifTag::CreateDate(date_tag.to_string()));
match metadata.write_to_file(path) {
Ok(_) => Ok(()),
Err(e) => return Err(e.to_string()),
}
}
6 changes: 6 additions & 0 deletions src/parser.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
use chrono::{DateTime, Utc};
use regex::Regex;

#[derive(Clone, Debug)]
pub struct DateTimeUtc(pub DateTime<Utc>);

// https://github.com/waltzofpearls/dateparser/blob/main/dateparser/src/lib.rs
// https://github.com/waltzofpearls/dateparser/blob/main/dateparser/src/datetime.rs#L26

pub struct Parser {
patterns: Vec<Regex>,
}
Expand Down
1 change: 0 additions & 1 deletion src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ impl FromIterator<DirEntry> for Stats {
}
};
}

s
}
}

0 comments on commit b4a800f

Please sign in to comment.