pinakes-core: improve media management features; various configuration improvements

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I2d1f04f13970d21c36067f30bc04a9176a6a6964
This commit is contained in:
raf 2026-02-05 00:54:10 +03:00
commit e02c15490e
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
31 changed files with 1167 additions and 197 deletions

View file

@ -102,6 +102,8 @@ pub struct Config {
pub cloud: CloudConfig,
#[serde(default)]
pub analytics: AnalyticsConfig,
#[serde(default)]
pub photos: PhotoConfig,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -499,6 +501,65 @@ impl Default for AnalyticsConfig {
}
}
// ===== Photo Management Configuration =====
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PhotoConfig {
/// Generate perceptual hashes for image duplicate detection (CPU-intensive)
#[serde(default = "default_true")]
pub generate_perceptual_hash: bool,
/// Automatically create tags from EXIF keywords
#[serde(default)]
pub auto_tag_from_exif: bool,
/// Generate multi-resolution thumbnails (tiny, grid, preview)
#[serde(default)]
pub multi_resolution_thumbnails: bool,
/// Auto-detect photo events/albums based on time and location
#[serde(default)]
pub enable_event_detection: bool,
/// Minimum number of photos to form an event
#[serde(default = "default_min_event_photos")]
pub min_event_photos: usize,
/// Maximum time gap between photos in the same event (in seconds)
#[serde(default = "default_event_time_gap")]
pub event_time_gap_secs: i64,
/// Maximum distance between photos in the same event (in kilometers)
#[serde(default = "default_event_distance")]
pub event_max_distance_km: f64,
}
fn default_min_event_photos() -> usize {
5
}
fn default_event_time_gap() -> i64 {
2 * 60 * 60 // 2 hours
}
fn default_event_distance() -> f64 {
1.0 // 1 km
}
impl Default for PhotoConfig {
fn default() -> Self {
Self {
generate_perceptual_hash: true,
auto_tag_from_exif: false,
multi_resolution_thumbnails: false,
enable_event_detection: false,
min_event_photos: default_min_event_photos(),
event_time_gap_secs: default_event_time_gap(),
event_max_distance_km: default_event_distance(),
}
}
}
// ===== Storage Configuration =====
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -867,6 +928,7 @@ impl Default for Config {
enrichment: EnrichmentConfig::default(),
cloud: CloudConfig::default(),
analytics: AnalyticsConfig::default(),
photos: PhotoConfig::default(),
}
}
}