|
|
@ -127,6 +127,7 @@ fn download_command( |
|
|
|
Err(e) => println!("Error setting progress setting: {}", e),
|
|
|
|
Ok(_) => (),
|
|
|
|
};
|
|
|
|
let mut progress_length: usize = 0;
|
|
|
|
match easy.progress_function(
|
|
|
|
move |total_bytes_to_download,
|
|
|
|
bytes_downloaded,
|
|
|
@ -134,13 +135,23 @@ fn download_command( |
|
|
|
_bytes_uploaded| {
|
|
|
|
let percentage =
|
|
|
|
calculate_percentage(bytes_downloaded, total_bytes_to_download);
|
|
|
|
match print_progress(
|
|
|
|
format!(
|
|
|
|
"{}: {:.2}% {}",
|
|
|
|
progress_filename, percentage, &progress_count
|
|
|
|
)
|
|
|
|
.as_bytes(),
|
|
|
|
) {
|
|
|
|
let mut progress = format!(
|
|
|
|
"{}: {:.2}% {}",
|
|
|
|
progress_filename, percentage, &progress_count
|
|
|
|
);
|
|
|
|
progress_length = if progress.len() > progress_length {
|
|
|
|
progress.len()
|
|
|
|
} else {
|
|
|
|
progress_length
|
|
|
|
};
|
|
|
|
if progress_length > progress.len() {
|
|
|
|
progress = format!(
|
|
|
|
"{}{}",
|
|
|
|
progress,
|
|
|
|
" ".repeat(progress_length - progress.len())
|
|
|
|
);
|
|
|
|
}
|
|
|
|
match print_progress(progress.as_bytes()) {
|
|
|
|
Err(e) => println!("Error showing downloading progress: {}", e),
|
|
|
|
Ok(_) => (),
|
|
|
|
};
|
|
|
@ -176,8 +187,9 @@ fn download_command( |
|
|
|
state_manager.save(new_state);
|
|
|
|
println!(
|
|
|
|
"Downloaded {:#?}/{:#?} images",
|
|
|
|
favorites_downloaded_count, all_downloaded_count
|
|
|
|
)
|
|
|
|
favorites_downloaded_count, to_download_count
|
|
|
|
);
|
|
|
|
println!("Total Downloaded: {:#?}", all_downloaded_count);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn favorites_command(backup: model::anime_boxes::Backup) {
|
|
|
|