Implement the video adapter to retrieve the root folder content.
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
use std::io::Read;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum LibraryItemType {
|
||||
VIDEO,
|
||||
FOLDER
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct LibraryItem {
|
||||
pub id: Uuid,
|
||||
pub name: String,
|
||||
pub r#type: LibraryItemType,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct LibraryRawItem {
|
||||
pub id: Option<Uuid>,
|
||||
pub name: String,
|
||||
@@ -21,7 +24,7 @@ impl LibraryRawItem {
|
||||
pub fn map_to_library_item(&self) -> LibraryItem {
|
||||
LibraryItem {
|
||||
id: self.id.unwrap_or(Uuid::new_v4()),
|
||||
name: self.name,
|
||||
name: self.name.clone(),
|
||||
r#type: self.r#type,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ pub trait VideoPort: Send + Sync {
|
||||
fn list_folder(&self, folder_id: Uuid) -> Result<Vec<LibraryRawItem>, VideoError>;
|
||||
fn get_video_stream(&self, video_id: Uuid) -> Result<Video, VideoError>;
|
||||
fn save(&self, library_item: &LibraryItem) -> Result<(), VideoError>;
|
||||
fn save_all(&self, library_items: &Vec<LibraryItem>) -> Result<(), VideoError>;
|
||||
fn clone_box(&self) -> Box<dyn VideoPort>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user