1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//! # Media Analyzer
//!
//! A toolkit for extracting info from video and photo files.
//!
//! This crate provides a high-level, asynchronous API to analyze media files. It acts as a
//! facade over tools like `exiftool`, combining raw metadata with parsing,
//! geolocation, and historical weather data to produce a single, easy-to-use result.
//!
//! The core philosophy is to be a "best-effort" analyzer. It robustly processes what it can,
//! and provides detailed information in a structured format.
//!
//! ## Prerequisites
//!
//! This crate requires a command-line installation of **`exiftool`** to be available in the
//! system's PATH. You can download it from the [official ExifTool website](https://exiftool.org/).
//! You can also pass the location of you exiftool executable if you don't want it in PATH.
//!
//! ## Key Features
//!
//! - **Unified Metadata**: Gathers basic properties like width, height, duration, and MIME type
//! into a clean [`BasicMetadata`] struct, while also providing photographic details like ISO,
//! aperture, and camera model in [`CameraSettings`].
//!
//! - **Time Resolution**: It analyzes multiple EXIF
//! tags, file metadata, and GPS data to determine the most accurate UTC timestamp and timezone
//! information, summarized in the [`TimeInfo`] struct.
//!
//! - **Geolocation & Weather**: Automatically performs reverse geocoding on GPS coordinates to find
//! human-readable location names ([`GpsInfo`]). If successful, it then fetches historical weather
//! and sun data (sunrise, sunset) for the precise time and place the media was captured,
//! populating the [`WeatherInfo`] struct.
//!
//! - **Rich Media Tagging**: Identifies a wide variety of special media characteristics, such as
//! `is_motion_photo`, `is_hdr`, `is_burst`, `is_slowmotion`, and `is_timelapse`, all available
//! in the [`MediaFeatures`] struct.
//!
//! - **Thumbnail Generation**: Creates a tiny, Base64-encoded JPEG data URL, for use as
//! a blurred placeholder in a UI while the full media loads.
//!
//! ## The `MediaMetadata` Struct
//!
//! The primary output of this crate is the [`MediaMetadata`] struct. It is a single, consolidated
//! container that holds all the information gathered during the analysis pipeline, making it
//! easy to access any piece of data you need.
//!
//! ## Usage
//!
//! 1. Create a [`MediaAnalyzer`] instance using its builder.
//! 2. Call the [`MediaAnalyzer::analyze_media`] method with the path to your media file.
//!
//! ```rust
//! use std::path::Path;
//! use media_analyzer::{MediaAnalyzer, MediaAnalyzerError};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), MediaAnalyzerError> {
//! // 1. Build the analyzer. The builder allows for custom configuration.
//! let analyzer = MediaAnalyzer::builder()
//! .weather_search_radius_km(50.0) // Optional: configure the analyzer
//! .build()
//! .await?;
//!
//! // 2. Define the path to the media file to analyze.
//! let media_file = Path::new("assets/sunset.jpg");
//!
//! // 3. Analyze the media file. For a photo, the file itself can serve as the thumbnail.
//! let result = analyzer.analyze_media(media_file).await?;
//!
//! // 4. Access the structured data from the `MediaMetadata`.
//! if let Some(gps) = result.gps {
//! println!("Location: {}, {}", gps.location.name, gps.location.country_code);
//! }
//!
//! if let Some(model) = result.camera.camera_model {
//! println!("Camera: {}", model);
//! }
//!
//! if let Some(utc_time) = result.time.datetime_utc {
//! println!("Taken at (UTC): {}", utc_time);
//! }
//!
//! Ok(())
//! }
//! ```
// --- Public API Exports ---
pub use MediaAnalyzer;
pub use MediaAnalyzerBuilder;
// The primary error type
pub use MediaAnalyzerError;
// The main result struct and its components
pub use ;
pub use ;
pub use ;
pub use ;
pub use MediaMetadata;
pub use MediaFeatures;
pub use ;