feat: add date_taken field to media model and update related functionalities
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user