mirror of
https://github.com/amtoaer/bili-sync.git
synced 2026-09-05 15:39:07 +08:00
fix: 修复代码语义错误,精简一些不必要的代码
This commit is contained in:
@@ -462,15 +462,11 @@ pub async fn fetch_page_video(
|
|||||||
.await?
|
.await?
|
||||||
.best_stream(&CONFIG.filter_option)?;
|
.best_stream(&CONFIG.filter_option)?;
|
||||||
match streams {
|
match streams {
|
||||||
BestStream::Mixed(mix_stream) => {
|
BestStream::Mixed(mix_stream) => downloader.fetch(mix_stream.url(), &page_path).await,
|
||||||
downloader.fetch(mix_stream.url(), &page_path).await?;
|
|
||||||
}
|
|
||||||
BestStream::VideoAudio {
|
BestStream::VideoAudio {
|
||||||
video: video_stream,
|
video: video_stream,
|
||||||
audio: None,
|
audio: None,
|
||||||
} => {
|
} => downloader.fetch(video_stream.url(), &page_path).await,
|
||||||
downloader.fetch(video_stream.url(), &page_path).await?;
|
|
||||||
}
|
|
||||||
BestStream::VideoAudio {
|
BestStream::VideoAudio {
|
||||||
video: video_stream,
|
video: video_stream,
|
||||||
audio: Some(audio_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_video"),
|
||||||
page_path.with_extension("tmp_audio"),
|
page_path.with_extension("tmp_audio"),
|
||||||
);
|
);
|
||||||
let res = {
|
let res = async {
|
||||||
downloader.fetch(video_stream.url(), &tmp_video_path).await?;
|
downloader.fetch(video_stream.url(), &tmp_video_path).await?;
|
||||||
downloader.fetch(audio_stream.url(), &tmp_audio_path).await?;
|
downloader.fetch(audio_stream.url(), &tmp_audio_path).await?;
|
||||||
downloader.merge(&tmp_video_path, &tmp_audio_path, &page_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_video_path).await;
|
||||||
let _ = fs::remove_file(tmp_audio_path).await;
|
let _ = fs::remove_file(tmp_audio_path).await;
|
||||||
res?;
|
res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn fetch_page_danmaku(
|
pub async fn fetch_page_danmaku(
|
||||||
@@ -507,8 +503,7 @@ pub async fn fetch_page_danmaku(
|
|||||||
.get_danmaku_writer(page_info)
|
.get_danmaku_writer(page_info)
|
||||||
.await?
|
.await?
|
||||||
.write(danmaku_path)
|
.write(danmaku_path)
|
||||||
.await?;
|
.await
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn generate_page_nfo(
|
pub async fn generate_page_nfo(
|
||||||
|
|||||||
Reference in New Issue
Block a user