mirror of
https://github.com/lanyeeee/bilibili-video-downloader.git
synced 2026-08-28 19:47:24 +08:00
fix: 修复插件修改DownloadProgress后导致已完成任务状态被回滚的问题
This commit is contained in:
@@ -217,6 +217,9 @@ impl DownloadProgress {
|
||||
|
||||
self.prepare(app).await.wrap_err("准备下载失败")?;
|
||||
|
||||
self.completed_ts = None; // 重置完成时间戳
|
||||
download_task.update_progress(|p| *p = self.clone());
|
||||
|
||||
let progress_before_hook = self.clone();
|
||||
app.get_plugin_manager()
|
||||
.run_hook(HookContext::AfterPrepare(AfterPrepareContext::new(self)))
|
||||
@@ -225,9 +228,6 @@ impl DownloadProgress {
|
||||
download_task.update_progress(|p| *p = self.clone());
|
||||
}
|
||||
|
||||
self.completed_ts = None; // 重置完成时间戳
|
||||
download_task.update_progress(|p| *p = self.clone());
|
||||
|
||||
std::fs::create_dir_all(&self.episode_dir)
|
||||
.wrap_err(format!("创建目录`{}`失败", self.episode_dir.display()))?;
|
||||
|
||||
@@ -250,6 +250,7 @@ impl DownloadProgress {
|
||||
tracing::debug!("音频下载任务完成");
|
||||
}
|
||||
|
||||
*self = download_task.progress.read().clone();
|
||||
let progress_before_hook = self.clone();
|
||||
app.get_plugin_manager()
|
||||
.run_hook(HookContext::BeforeVideoProcess(
|
||||
@@ -324,6 +325,7 @@ impl DownloadProgress {
|
||||
download_task.update_progress(|p| p.completed_ts = Some(completed_ts));
|
||||
}
|
||||
|
||||
*self = download_task.progress.read().clone();
|
||||
let progress_before_hook = self.clone();
|
||||
app.get_plugin_manager()
|
||||
.run_hook(HookContext::OnCompleted(OnCompletedContext::new(self)))
|
||||
|
||||
Reference in New Issue
Block a user