diff --git a/Cargo.toml b/Cargo.toml index 80b2fee..6079eb1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "splitter" -version = "0.1.0" +version = "0.1.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/client.rs b/src/client.rs index 3c675d5..770a3cf 100644 --- a/src/client.rs +++ b/src/client.rs @@ -36,8 +36,9 @@ impl SplitterClient { let result = self.inner_split_video(id.clone()).await; match result { - Ok(_) => { + Ok(count) => { video.status = ActiveValue::Set(Status::Split); + video.part_count = ActiveValue::Set(count as i32); video.clone().update(&self.db).await?; } Err(err) => { @@ -48,7 +49,7 @@ impl SplitterClient { } Ok(()) } - async fn inner_split_video(&self, id: String) -> Result<()> { + async fn inner_split_video(&self, id: String) -> Result { let base_path = Path::new(&self.conf.download_folder_path); let input_path = base_path.join(format!("{}.mp4", id)); let output_folder_path = base_path.join(&id); @@ -109,7 +110,7 @@ impl SplitterClient { let duration = Instant::now().duration_since(start_time); info!("Done Splitting. Whole operation took: {:?}", duration); debug!("paths: {:?}", paths); - Ok(()) + Ok(paths.len()) } #[tracing::instrument(skip(self))]