Refactor file type checking for better consistency
Fix tests
This commit is contained in:
11
src/exif.rs
11
src/exif.rs
@@ -7,8 +7,7 @@ use exif::{In, Reader, Tag, Value};
|
||||
use log::debug;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Default)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct ExifData {
|
||||
pub camera_make: Option<String>,
|
||||
pub camera_model: Option<String>,
|
||||
@@ -26,7 +25,6 @@ pub struct ExifData {
|
||||
pub date_taken: Option<i64>,
|
||||
}
|
||||
|
||||
|
||||
pub fn supports_exif(path: &Path) -> bool {
|
||||
if let Some(ext) = path.extension() {
|
||||
let ext_lower = ext.to_string_lossy().to_lowercase();
|
||||
@@ -248,9 +246,10 @@ fn extract_gps_altitude(exif: &exif::Exif) -> Option<f64> {
|
||||
// Check if below sea level
|
||||
if let Some(ref_field) = exif.get_field(Tag::GPSAltitudeRef, In::PRIMARY)
|
||||
&& let Some(ref_val) = get_u32_value(ref_field)
|
||||
&& ref_val == 1 {
|
||||
return Some(-altitude);
|
||||
}
|
||||
&& ref_val == 1
|
||||
{
|
||||
return Some(-altitude);
|
||||
}
|
||||
|
||||
Some(altitude)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user