Add filename date to metadata if available

This commit is contained in:
Cameron
2025-12-29 21:54:25 -05:00
parent 2d915518e2
commit 4d9addaf22
3 changed files with 7 additions and 1 deletions

View File

@@ -204,6 +204,7 @@ pub struct MetadataResponse {
pub modified: Option<i64>,
pub size: u64,
pub exif: Option<ExifMetadata>,
pub filename_date: Option<i64>, // Date extracted from filename
}
impl From<fs::Metadata> for MetadataResponse {
@@ -219,6 +220,7 @@ impl From<fs::Metadata> for MetadataResponse {
}),
size: metadata.len(),
exif: None,
filename_date: None, // Will be set in endpoint handler
}
}
}

View File

@@ -172,6 +172,10 @@ async fn get_file_metadata(
Ok(metadata) => {
let mut response: MetadataResponse = metadata.into();
// Extract date from filename if possible
response.filename_date =
memories::extract_date_from_filename(&path.path).map(|dt| dt.timestamp());
// Query EXIF data if available
if let Ok(mut dao) = exif_dao.lock()
&& let Ok(Some(exif)) = dao.get_exif(&span_context, &path.path)