Implement the video adapter to retrieve the root folder content.

This commit is contained in:
Florian THIERRY
2026-07-14 21:35:55 +02:00
parent fc7eeb1d57
commit beb0134dfc
11 changed files with 90 additions and 29 deletions
@@ -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,
}
}
+1
View File
@@ -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>;
}