use gufo_common::types::Rational;
use gufo_common::{geography, hardware, orientation};
use gufo_exif::Exif;
use gufo_xmp::Xmp;
use crate::Metadata;
impl Metadata {
pub fn camera_owner_name(&self) -> Option<String> {
self.lookup_exif_xmp(Exif::camera_owner_name, Xmp::camera_owner_name)
}
pub fn creator(&self) -> Option<String> {
self.lookup_exif_xmp_keyval(Exif::artist, Xmp::creator, |x| x.get("Author").cloned())
}
#[cfg(feature = "chrono")]
pub fn date_time_original(&self) -> Option<gufo_common::datetime::DateTime> {
self.lookup_exif_xmp(Exif::date_time_original, Xmp::date_time_original)
}
pub fn digital_zoom_ratio(&self) -> Option<Rational<u32>> {
self.lookup_exif_xmp(Exif::digital_zoom_ratio, Xmp::digital_zoom_ratio)
}
pub fn exposure_time(&self) -> Option<Rational<u32>> {
self.lookup_exif_xmp(Exif::exposure_time, Xmp::exposure_time)
}
pub fn f_number(&self) -> Option<f32> {
self.lookup_exif_xmp(|x| Exif::f_number(x).map(|x| x.as_f32()), Xmp::f_number)
}
pub fn focal_length(&self) -> Option<Rational<u32>> {
self.lookup_exif_xmp(Exif::focal_length, Xmp::focal_length)
}
pub fn gps_location(&self) -> Option<geography::Location> {
self.lookup_exif(Exif::gps_location)
}
pub fn iso_speed_rating(&self) -> Option<u16> {
self.lookup_exif_xmp(Exif::iso_speed_rating, Xmp::iso_speed_rating)
}
pub fn lens_make(&self) -> Option<String> {
self.lookup_exif_xmp(Exif::lens_make, Xmp::lens_make)
}
pub fn lens_model(&self) -> Option<String> {
self.lookup_exif_xmp(Exif::lens_model, Xmp::lens_model)
}
pub fn lens_specification(&self) -> Option<hardware::LensSpecification> {
self.lookup_exif(Exif::lens_specification)
}
pub fn make(&self) -> Option<String> {
self.lookup_exif_xmp(Exif::make, Xmp::make)
}
pub fn model(&self) -> Option<String> {
self.lookup_exif_xmp(Exif::model, Xmp::model)
}
pub fn orientation(&self) -> Option<orientation::Orientation> {
self.lookup_exif_xmp(Exif::orientation, Xmp::orientation)
}
pub fn rights(&self) -> Option<String> {
self.lookup_exif_xmp_keyval(Exif::copyright, Xmp::rights, |x| {
x.get("Copyright").cloned()
})
}
pub fn rights_web_statement(&self) -> Option<String> {
self.lookup_xmp(Xmp::rights_web_statement)
}
pub fn software(&self) -> Option<String> {
self.lookup_exif_xmp_keyval(Exif::software, Xmp::creator_tool, |x| {
x.get("Software").cloned()
})
}
pub fn user_comment(&self) -> Option<String> {
self.lookup_exif_xmp_keyval(Exif::user_comment, Xmp::user_comment, |x| {
x.get("Comment").cloned()
})
}
}