28 lines
630 B
Rust
28 lines
630 B
Rust
use std::sync::Arc;
|
|
|
|
use async_trait::async_trait;
|
|
|
|
use crate::{
|
|
error::CoreResult,
|
|
models::Media,
|
|
repositories::{AlbumRepository, MediaRepository, UserRepository},
|
|
};
|
|
|
|
pub struct PluginData {
|
|
pub message: String,
|
|
}
|
|
|
|
pub struct PluginContext {
|
|
pub media_repo: Arc<dyn MediaRepository>,
|
|
pub album_repo: Arc<dyn AlbumRepository>,
|
|
pub user_repo: Arc<dyn UserRepository>,
|
|
pub media_library_path: String,
|
|
}
|
|
|
|
#[async_trait]
|
|
pub trait MediaProcessorPlugin: Send + Sync {
|
|
fn name(&self) -> &'static str;
|
|
|
|
async fn process(&self, media: &Media, context: &PluginContext) -> CoreResult<PluginData>;
|
|
}
|