Implement the service to list items in the root folder.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use std::io::Read;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub enum LibraryItemType {
|
||||
@@ -15,4 +16,13 @@ pub struct ReadLibraryItem {
|
||||
pub id: Option<Uuid>,
|
||||
pub name: String,
|
||||
pub r#type: LibraryItemType,
|
||||
}
|
||||
impl ReadLibraryItem {
|
||||
pub fn map_to_library_item(&self) -> LibraryItem {
|
||||
LibraryItem {
|
||||
id: self.id.unwrap_or(Uuid::new_v4()),
|
||||
name: self.name,
|
||||
r#type: self.r#type,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ pub trait VideoPort: Send + Sync {
|
||||
fn list_root_folder(&self) -> Result<Vec<ReadLibraryItem>, VideoError>;
|
||||
fn list_folder(&self, folder_id: Uuid) -> Result<Vec<ReadLibraryItem>, VideoError>;
|
||||
fn get_video_stream(&self, video_id: Uuid) -> Result<Video, VideoError>;
|
||||
fn save(&self, library_item: LibraryItem) -> Result<(), VideoError>;
|
||||
fn save(&self, library_item: &LibraryItem) -> Result<(), VideoError>;
|
||||
fn clone_box(&self) -> Box<dyn VideoPort>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user