Start to implement the VideoService list_root_folder method.

This commit is contained in:
Florian THIERRY
2026-07-14 14:27:45 +02:00
parent f8fd59b01a
commit 2df12118eb
11 changed files with 69 additions and 15 deletions
+31
View File
@@ -4,6 +4,37 @@ use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
use std::io::Read;
use lumiere_domain::video::error::VideoError;
use lumiere_domain::video::model::library_item::LibraryItem;
use lumiere_domain::video::port::VideoPort;
#[derive(Clone)]
pub struct VideoService {
video_port: Box<dyn VideoPort>
}
impl VideoService {
pub fn new(video_port: Box<dyn VideoPort>) -> Self {
Self { video_port }
}
pub fn list_root_folder(self) -> Result<Vec<LibraryItem>, VideoError> {
let library_items = self.video_port.list_root_folder()?;
let items_without_id = library_items.iter().filter(|item| item.id == None);
// generate a new Uuid for each item without id
// assign this new Uuid to the item
// save the item by using the method video_port.save
// replace the items_without_id by modified items_without_id
Ok(vec!())
}
}
/// Basic example: Read file line by line using BufReader
pub fn read_file_line_by_line(path: &str) -> std::io::Result<()> {