From cdc639cf751ec5d145868fa4d601c058aa414ffc Mon Sep 17 00:00:00 2001 From: amtoaer Date: Tue, 14 Jan 2025 02:21:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=AF=AD=E4=B9=89=E9=94=99=E8=AF=AF=EF=BC=8C=E7=B2=BE=E7=AE=80?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/bili_sync/src/workflow.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/crates/bili_sync/src/workflow.rs b/crates/bili_sync/src/workflow.rs index d1c5aa9..24af7ef 100644 --- a/crates/bili_sync/src/workflow.rs +++ b/crates/bili_sync/src/workflow.rs @@ -462,15 +462,11 @@ pub async fn fetch_page_video( .await? .best_stream(&CONFIG.filter_option)?; match streams { - BestStream::Mixed(mix_stream) => { - downloader.fetch(mix_stream.url(), &page_path).await?; - } + BestStream::Mixed(mix_stream) => downloader.fetch(mix_stream.url(), &page_path).await, BestStream::VideoAudio { video: video_stream, audio: None, - } => { - downloader.fetch(video_stream.url(), &page_path).await?; - } + } => downloader.fetch(video_stream.url(), &page_path).await, BestStream::VideoAudio { video: video_stream, audio: Some(audio_stream), @@ -479,17 +475,17 @@ pub async fn fetch_page_video( page_path.with_extension("tmp_video"), page_path.with_extension("tmp_audio"), ); - let res = { + let res = async { downloader.fetch(video_stream.url(), &tmp_video_path).await?; downloader.fetch(audio_stream.url(), &tmp_audio_path).await?; downloader.merge(&tmp_video_path, &tmp_audio_path, &page_path).await - }; + } + .await; let _ = fs::remove_file(tmp_video_path).await; let _ = fs::remove_file(tmp_audio_path).await; - res?; + res } } - Ok(()) } pub async fn fetch_page_danmaku( @@ -507,8 +503,7 @@ pub async fn fetch_page_danmaku( .get_danmaku_writer(page_info) .await? .write(danmaku_path) - .await?; - Ok(()) + .await } pub async fn generate_page_nfo(