feat: implement media metadata management with EXIF and TrackInfo support

This commit is contained in:
2025-11-14 07:41:54 +01:00
parent ea95c2255f
commit 55cf4db2de
18 changed files with 343 additions and 195 deletions

View File

@@ -25,6 +25,30 @@ impl From<&str> for Role {
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MediaMetadataSource {
Exif,
TrackInfo,
}
impl MediaMetadataSource {
pub fn as_str(&self) -> &'static str {
match self {
MediaMetadataSource::Exif => "exif",
MediaMetadataSource::TrackInfo => "track_info",
}
}
}
impl From<&str> for MediaMetadataSource {
fn from(s: &str) -> Self {
match s {
"track_info" => MediaMetadataSource::TrackInfo,
_ => MediaMetadataSource::Exif,
}
}
}
pub struct Media {
pub id: uuid::Uuid,
pub owner_id: uuid::Uuid,
@@ -33,13 +57,17 @@ pub struct Media {
pub mime_type: String,
pub hash: String,
pub created_at: chrono::DateTime<chrono::Utc>,
pub extracted_location: Option<String>,
pub width: Option<i32>,
pub height: Option<i32>,
pub date_taken: Option<chrono::DateTime<chrono::Utc>>,
pub thumbnail_path: Option<String>,
}
pub struct MediaMetadata {
pub id: uuid::Uuid,
pub media_id: uuid::Uuid,
pub source: MediaMetadataSource,
pub tag_name: String,
pub tag_value: String,
}
#[derive(Clone)]
pub struct User {
pub id: uuid::Uuid,