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]
|
[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
|
||||||
|
|||||||
@@ -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))]
|
||||||
|
|||||||
Reference in New Issue
Block a user