chore: rename photo extractor to EXIF extractor
parent
d1951363ce
commit
a8f820d68e
|
@ -96,7 +96,7 @@ default = [
|
|||
"previews-image",
|
||||
"extractors-web",
|
||||
"extractors-audio",
|
||||
"extractors-photo",
|
||||
"extractors-exif",
|
||||
"extractors-media",
|
||||
]
|
||||
desktop = ["webbrowser", "opener", "is_executable"]
|
||||
|
@ -104,5 +104,5 @@ previews = []
|
|||
previews-image = ["image", "webp", "kamadak-exif"]
|
||||
extractors-web = ["webpage"]
|
||||
extractors-audio = ["id3"]
|
||||
extractors-photo = ["kamadak-exif"]
|
||||
extractors-exif = ["kamadak-exif"]
|
||||
extractors-media = []
|
||||
|
|
|
@ -20,14 +20,14 @@ pub struct ExifExtractor;
|
|||
// model for enum-like values in UpEnd?
|
||||
|
||||
lazy_static! {
|
||||
pub static ref PHOTO_TYPE_INVARIANT: InvariantEntry = InvariantEntry {
|
||||
pub static ref EXIF_TYPE_INVARIANT: InvariantEntry = InvariantEntry {
|
||||
attribute: String::from(ATTR_KEY),
|
||||
value: "TYPE_PHOTO".into(),
|
||||
value: "TYPE_EXIF".into(),
|
||||
};
|
||||
pub static ref PHOTO_TYPE_LABEL: Entry = Entry {
|
||||
entity: PHOTO_TYPE_INVARIANT.entity().unwrap(),
|
||||
pub static ref EXIF_TYPE_LABEL: Entry = Entry {
|
||||
entity: EXIF_TYPE_INVARIANT.entity().unwrap(),
|
||||
attribute: ATTR_LABEL.into(),
|
||||
value: "Photo".into(),
|
||||
value: "EXIF".into(),
|
||||
..Default::default()
|
||||
};
|
||||
}
|
||||
|
@ -108,20 +108,20 @@ impl Extractor for ExifExtractor {
|
|||
.map(|e| Entry {
|
||||
entity: Address::Attribute(e.attribute.clone()),
|
||||
attribute: ATTR_OF.into(),
|
||||
value: EntryValue::Address(PHOTO_TYPE_INVARIANT.entity().unwrap()),
|
||||
value: EntryValue::Address(EXIF_TYPE_INVARIANT.entity().unwrap()),
|
||||
..Default::default()
|
||||
})
|
||||
.collect::<Vec<Entry>>(),
|
||||
);
|
||||
result.extend(vec![
|
||||
(&PHOTO_TYPE_INVARIANT as &InvariantEntry)
|
||||
(&EXIF_TYPE_INVARIANT as &InvariantEntry)
|
||||
.try_into()
|
||||
.unwrap(),
|
||||
PHOTO_TYPE_LABEL.clone(),
|
||||
EXIF_TYPE_LABEL.clone(),
|
||||
Entry {
|
||||
entity: address.clone(),
|
||||
attribute: ATTR_IN.into(),
|
||||
value: EntryValue::Address(PHOTO_TYPE_INVARIANT.entity().unwrap()),
|
||||
value: EntryValue::Address(EXIF_TYPE_INVARIANT.entity().unwrap()),
|
||||
..Default::default()
|
||||
},
|
||||
]);
|
||||
|
@ -139,7 +139,7 @@ impl Extractor for ExifExtractor {
|
|||
}
|
||||
|
||||
fn is_needed(&self, address: &Address, connection: &UpEndConnection) -> Result<bool> {
|
||||
let is_photo = connection.retrieve_object(address)?.iter().any(|e| {
|
||||
let is_exif = connection.retrieve_object(address)?.iter().any(|e| {
|
||||
if e.attribute == FILE_MIME_KEY {
|
||||
if let EntryValue::String(mime) = &e.value {
|
||||
return mime.starts_with("image");
|
||||
|
@ -148,7 +148,7 @@ impl Extractor for ExifExtractor {
|
|||
false
|
||||
});
|
||||
|
||||
if !is_photo {
|
||||
if !is_exif {
|
||||
return Ok(false);
|
||||
}
|
||||
|
|
@ -14,8 +14,8 @@ pub mod web;
|
|||
#[cfg(feature = "extractors-audio")]
|
||||
pub mod audio;
|
||||
|
||||
#[cfg(feature = "extractors-photo")]
|
||||
pub mod photo;
|
||||
#[cfg(feature = "extractors-exif")]
|
||||
pub mod exif;
|
||||
|
||||
#[cfg(feature = "extractors-media")]
|
||||
pub mod media;
|
||||
|
@ -141,9 +141,9 @@ pub fn extract(
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "extractors-photo")]
|
||||
#[cfg(feature = "extractors-exif")]
|
||||
{
|
||||
let extract_result = photo::ExifExtractor.insert_info(
|
||||
let extract_result = exif::ExifExtractor.insert_info(
|
||||
address,
|
||||
connection,
|
||||
store.clone(),
|
||||
|
|
Loading…
Reference in New Issue