mirror of
https://github.com/lanyeeee/bilibili-video-downloader.git
synced 2026-09-08 17:16:52 +08:00
fix: 修复代码编写错误导致的while let提前终止问题
This commit is contained in:
@@ -818,7 +818,11 @@ impl BiliClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(Ok(Some((url, content_length)))) = join_set.join_next().await {
|
while let Some(join_result) = join_set.join_next().await {
|
||||||
|
let Ok(Some((url, content_length))) = join_result else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
url_with_content_length.push((url, content_length));
|
url_with_content_length.push((url, content_length));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -868,7 +872,11 @@ impl BiliClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut replies = Vec::new();
|
let mut replies = Vec::new();
|
||||||
while let Some(Ok(res)) = join_set.join_next().await {
|
while let Some(join_result) = join_set.join_next().await {
|
||||||
|
let Ok(res) = join_result else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
let reply = res?;
|
let reply = res?;
|
||||||
replies.push(reply);
|
replies.push(reply);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,11 @@ impl AudioTask {
|
|||||||
|
|
||||||
let mut medias: Vec<MediaForPrepare> = Vec::new();
|
let mut medias: Vec<MediaForPrepare> = Vec::new();
|
||||||
|
|
||||||
while let Some(Ok(media)) = join_set.join_next().await {
|
while let Some(join_result) = join_set.join_next().await {
|
||||||
|
let Ok(media) = join_result else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
if !media.url_with_content_length.is_empty() {
|
if !media.url_with_content_length.is_empty() {
|
||||||
medias.push(media);
|
medias.push(media);
|
||||||
}
|
}
|
||||||
@@ -167,7 +171,11 @@ impl AudioTask {
|
|||||||
|
|
||||||
let mut medias: Vec<MediaForPrepare> = Vec::new();
|
let mut medias: Vec<MediaForPrepare> = Vec::new();
|
||||||
|
|
||||||
while let Some(Ok(media)) = join_set.join_next().await {
|
while let Some(join_result) = join_set.join_next().await {
|
||||||
|
let Ok(media) = join_result else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
if !media.url_with_content_length.is_empty() {
|
if !media.url_with_content_length.is_empty() {
|
||||||
medias.push(media);
|
medias.push(media);
|
||||||
}
|
}
|
||||||
@@ -223,7 +231,11 @@ impl AudioTask {
|
|||||||
|
|
||||||
let mut medias: Vec<MediaForPrepare> = Vec::new();
|
let mut medias: Vec<MediaForPrepare> = Vec::new();
|
||||||
|
|
||||||
while let Some(Ok(media)) = join_set.join_next().await {
|
while let Some(join_result) = join_set.join_next().await {
|
||||||
|
let Ok(media) = join_result else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
if !media.url_with_content_length.is_empty() {
|
if !media.url_with_content_length.is_empty() {
|
||||||
medias.push(media);
|
medias.push(media);
|
||||||
}
|
}
|
||||||
@@ -371,8 +383,12 @@ impl AudioTask {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(Ok(download_video_result)) = join_set.join_next().await {
|
while let Some(join_result) = join_set.join_next().await {
|
||||||
match download_video_result {
|
let Ok(download_audio_result) = join_result else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
|
match download_audio_result {
|
||||||
Ok(i) => download_task.update_progress(|p| p.audio_task.chunks[i].completed = true),
|
Ok(i) => download_task.update_progress(|p| p.audio_task.chunks[i].completed = true),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let err_title = format!("{ids_string} `{episode_title}`音频的一个分片下载失败");
|
let err_title = format!("{ids_string} `{episode_title}`音频的一个分片下载失败");
|
||||||
@@ -402,7 +418,7 @@ impl AudioTask {
|
|||||||
))?;
|
))?;
|
||||||
|
|
||||||
if !is_audio_file_complete {
|
if !is_audio_file_complete {
|
||||||
download_task.update_progress(|p| p.video_task.mark_uncompleted());
|
download_task.update_progress(|p| p.audio_task.mark_uncompleted());
|
||||||
return Err(anyhow!(
|
return Err(anyhow!(
|
||||||
"音频文件`{}`不完整,[继续]会重新下载所有分片",
|
"音频文件`{}`不完整,[继续]会重新下载所有分片",
|
||||||
temp_file_path.display()
|
temp_file_path.display()
|
||||||
|
|||||||
@@ -91,7 +91,11 @@ impl VideoTask {
|
|||||||
|
|
||||||
let mut medias: Vec<MediaForPrepare> = Vec::new();
|
let mut medias: Vec<MediaForPrepare> = Vec::new();
|
||||||
|
|
||||||
while let Some(Ok(media)) = join_set.join_next().await {
|
while let Some(join_result) = join_set.join_next().await {
|
||||||
|
let Ok(media) = join_result else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
if !media.url_with_content_length.is_empty() {
|
if !media.url_with_content_length.is_empty() {
|
||||||
medias.push(media);
|
medias.push(media);
|
||||||
}
|
}
|
||||||
@@ -157,7 +161,11 @@ impl VideoTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(Ok(media)) = join_set.join_next().await {
|
while let Some(join_result) = join_set.join_next().await {
|
||||||
|
let Ok(media) = join_result else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
if !media.url_with_content_length.is_empty() {
|
if !media.url_with_content_length.is_empty() {
|
||||||
medias.push(media);
|
medias.push(media);
|
||||||
}
|
}
|
||||||
@@ -223,7 +231,11 @@ impl VideoTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(Ok(media)) = join_set.join_next().await {
|
while let Some(join_result) = join_set.join_next().await {
|
||||||
|
let Ok(media) = join_result else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
if !media.url_with_content_length.is_empty() {
|
if !media.url_with_content_length.is_empty() {
|
||||||
medias.push(media);
|
medias.push(media);
|
||||||
}
|
}
|
||||||
@@ -384,7 +396,11 @@ impl VideoTask {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(Ok(download_video_result)) = join_set.join_next().await {
|
while let Some(join_result) = join_set.join_next().await {
|
||||||
|
let Ok(download_video_result) = join_result else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
match download_video_result {
|
match download_video_result {
|
||||||
Ok(i) => download_task.update_progress(|p| p.video_task.chunks[i].completed = true),
|
Ok(i) => download_task.update_progress(|p| p.video_task.chunks[i].completed = true),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user