set part count on db

This commit is contained in:
OMGeeky
2023-10-20 18:31:16 +02:00
parent 083fb7f998
commit 0980735b36
2 changed files with 5 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "splitter" name = "splitter"
version = "0.1.0" version = "0.1.1"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -36,8 +36,9 @@ impl SplitterClient {
let result = self.inner_split_video(id.clone()).await; let result = self.inner_split_video(id.clone()).await;
match result { match result {
Ok(_) => { Ok(count) => {
video.status = ActiveValue::Set(Status::Split); video.status = ActiveValue::Set(Status::Split);
video.part_count = ActiveValue::Set(count as i32);
video.clone().update(&self.db).await?; video.clone().update(&self.db).await?;
} }
Err(err) => { Err(err) => {
@@ -48,7 +49,7 @@ impl SplitterClient {
} }
Ok(()) Ok(())
} }
async fn inner_split_video(&self, id: String) -> Result<()> { async fn inner_split_video(&self, id: String) -> Result<usize> {
let base_path = Path::new(&self.conf.download_folder_path); let base_path = Path::new(&self.conf.download_folder_path);
let input_path = base_path.join(format!("{}.mp4", id)); let input_path = base_path.join(format!("{}.mp4", id));
let output_folder_path = base_path.join(&id); let output_folder_path = base_path.join(&id);
@@ -109,7 +110,7 @@ impl SplitterClient {
let duration = Instant::now().duration_since(start_time); let duration = Instant::now().duration_since(start_time);
info!("Done Splitting. Whole operation took: {:?}", duration); info!("Done Splitting. Whole operation took: {:?}", duration);
debug!("paths: {:?}", paths); debug!("paths: {:?}", paths);
Ok(()) Ok(paths.len())
} }
#[tracing::instrument(skip(self))] #[tracing::instrument(skip(self))]