feat: add date_taken field to media model and update related functionalities

This commit is contained in:
2025-11-04 05:28:27 +01:00
parent 39ee8d52a4
commit 828d8e4a2b
11 changed files with 48 additions and 10 deletions

View File

@@ -7,7 +7,7 @@ use libertas_core::{
plugins::{MediaProcessorPlugin, PluginContext, PluginData},
};
use tokio::fs;
use xmp_toolkit::XmpMeta;
use xmp_toolkit::{XmpMeta, XmpValue};
pub struct XmpWriterPlugin;
@@ -39,6 +39,18 @@ impl MediaProcessorPlugin for XmpWriterPlugin {
CoreError::Unknown(format!("Failed to set description property in XMP: {}", e))
})?;
if let Some(date_taken) = &fresh_media.date_taken {
let date_str = date_taken.to_rfc3339();
xmp.set_property(
"http://ns.adobe.com/exif/1.0/",
"DateTimeOriginal",
&XmpValue::from(date_str),
)
.map_err(|e| {
CoreError::Unknown(format!("Failed to set DateTimeOriginal in XMP: {}", e))
})?;
}
if let Some(_location) = &fresh_media.extracted_location {
// TODO: Set location properties in XMP
}