mirror of
https://github.com/OMGeeky/twba.splitter.git
synced 2026-02-23 15:49:57 +01:00
set part count on db
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<usize> {
|
||||
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))]
|
||||
|
||||
Reference in New Issue
Block a user