fix: Do not exit if other songs can be downloaded (#77)
This commit is contained in:
parent
9726142bd7
commit
92cf74bded
1 changed files with 10 additions and 9 deletions
19
src/main.rs
19
src/main.rs
|
|
@ -161,9 +161,9 @@ async fn start() {
|
||||||
let progress: String;
|
let progress: String;
|
||||||
|
|
||||||
if state != DownloadState::Done {
|
if state != DownloadState::Done {
|
||||||
exit_flag &= 0;
|
|
||||||
progress = match state {
|
progress = match state {
|
||||||
DownloadState::Downloading(r, t) => {
|
DownloadState::Downloading(r, t) => {
|
||||||
|
exit_flag &= 0;
|
||||||
let p = r as f32 / t as f32 * 100.0;
|
let p = r as f32 / t as f32 * 100.0;
|
||||||
if p > 100.0 {
|
if p > 100.0 {
|
||||||
"100%".to_string()
|
"100%".to_string()
|
||||||
|
|
@ -171,17 +171,18 @@ async fn start() {
|
||||||
format!("{}%", p as i8)
|
format!("{}%", p as i8)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DownloadState::Post => "Postprocessing... ".to_string(),
|
DownloadState::Post => {
|
||||||
DownloadState::None => "Preparing... ".to_string(),
|
exit_flag &= 0;
|
||||||
DownloadState::Lock => "Preparing... ".to_string(),
|
"Postprocessing... ".to_string()
|
||||||
|
}
|
||||||
|
DownloadState::None | DownloadState::Lock => {
|
||||||
|
exit_flag &= 0;
|
||||||
|
"Preparing... ".to_string()
|
||||||
|
}
|
||||||
DownloadState::Error(e) => {
|
DownloadState::Error(e) => {
|
||||||
exit_flag |= 1;
|
|
||||||
format!("{} ", e)
|
format!("{} ", e)
|
||||||
}
|
}
|
||||||
DownloadState::Done => {
|
DownloadState::Done => "Impossible state".to_string(),
|
||||||
exit_flag |= 1;
|
|
||||||
"Impossible state".to_string()
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
progress = "Done.".to_string();
|
progress = "Done.".to_string();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue