feat: implement media metadata management with EXIF and TrackInfo support
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use libertas_core::models::{Album, AlbumPermission, AlbumShare, Media, Role, User};
|
||||
use libertas_core::models::{Album, AlbumPermission, AlbumShare, Media, MediaMetadata, MediaMetadataSource, Role, User};
|
||||
|
||||
use crate::db_models::{PostgresAlbum, PostgresAlbumPermission, PostgresAlbumShare, PostgresMedia, PostgresRole, PostgresUser};
|
||||
use crate::db_models::{PostgresAlbum, PostgresAlbumPermission, PostgresAlbumShare, PostgresMedia, PostgresMediaMetadata, PostgresMediaMetadataSource, PostgresRole, PostgresUser};
|
||||
|
||||
impl From<PostgresRole> for Role {
|
||||
fn from(pg_role: PostgresRole) -> Self {
|
||||
@@ -20,6 +20,24 @@ impl From<Role> for PostgresRole {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PostgresMediaMetadataSource> for MediaMetadataSource {
|
||||
fn from(pg_source: PostgresMediaMetadataSource) -> Self {
|
||||
match pg_source {
|
||||
PostgresMediaMetadataSource::Exif => MediaMetadataSource::Exif,
|
||||
PostgresMediaMetadataSource::TrackInfo => MediaMetadataSource::TrackInfo,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<MediaMetadataSource> for PostgresMediaMetadataSource {
|
||||
fn from(source: MediaMetadataSource) -> Self {
|
||||
match source {
|
||||
MediaMetadataSource::Exif => PostgresMediaMetadataSource::Exif,
|
||||
MediaMetadataSource::TrackInfo => PostgresMediaMetadataSource::TrackInfo,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PostgresUser> for User {
|
||||
fn from(pg_user: PostgresUser) -> Self {
|
||||
User {
|
||||
@@ -60,15 +78,23 @@ impl From<PostgresMedia> for Media {
|
||||
mime_type: pg_media.mime_type,
|
||||
hash: pg_media.hash,
|
||||
created_at: pg_media.created_at,
|
||||
extracted_location: pg_media.extracted_location,
|
||||
width: pg_media.width,
|
||||
height: pg_media.height,
|
||||
date_taken: pg_media.date_taken,
|
||||
thumbnail_path: pg_media.thumbnail_path,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PostgresMediaMetadata> for MediaMetadata {
|
||||
fn from(pg_metadata: PostgresMediaMetadata) -> Self {
|
||||
MediaMetadata {
|
||||
id: pg_metadata.id,
|
||||
media_id: pg_metadata.media_id,
|
||||
source: MediaMetadataSource::from(pg_metadata.source.as_str()),
|
||||
tag_name: pg_metadata.tag_name,
|
||||
tag_value: pg_metadata.tag_value,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PostgresAlbumPermission> for AlbumPermission {
|
||||
fn from(pg_permission: PostgresAlbumPermission) -> Self {
|
||||
match pg_permission {
|
||||
|
||||
Reference in New Issue
Block a user