1
0
Fork 0
mirror of synced 2024-06-01 18:19:46 +12:00

Commons, improved GUI message

This commit is contained in:
Rafał Mikrut 2023-05-06 20:53:23 +02:00
parent 5eb6d6fafe
commit 3cbf6bf0c1
4 changed files with 67 additions and 223 deletions

View file

@ -403,7 +403,7 @@ impl SameMusic {
1, 1,
2, 2,
non_cached_files_to_check.len(), non_cached_files_to_check.len(),
CheckingMethod::None, self.check_type,
); );
let configuration = &self.hash_preset_config; let configuration = &self.hash_preset_config;
@ -460,7 +460,7 @@ impl SameMusic {
1, 1,
2, 2,
non_cached_files_to_check.len(), non_cached_files_to_check.len(),
CheckingMethod::None, self.check_type,
); );
// Clean for duplicate files // Clean for duplicate files
@ -593,15 +593,7 @@ impl SameMusic {
let progress_thread_run = Arc::new(AtomicBool::new(true)); let progress_thread_run = Arc::new(AtomicBool::new(true));
let atomic_counter = Arc::new(AtomicUsize::new(0)); let atomic_counter = Arc::new(AtomicUsize::new(0));
let progress_thread_handle = prepare_thread_handler_common( let progress_thread_handle = prepare_thread_handler_common(progress_sender, &progress_thread_run, &atomic_counter, 2, 2, self.music_to_check.len(), self.check_type);
progress_sender,
&progress_thread_run,
&atomic_counter,
2,
2,
self.music_to_check.len(),
CheckingMethod::None,
);
let mut old_duplicates: Vec<Vec<MusicEntry>> = vec![self.music_entries.clone()]; let mut old_duplicates: Vec<Vec<MusicEntry>> = vec![self.music_entries.clone()];
let mut new_duplicates: Vec<Vec<MusicEntry>> = Vec::new(); let mut new_duplicates: Vec<Vec<MusicEntry>> = Vec::new();
@ -714,10 +706,15 @@ impl SameMusic {
(base_files, files_to_compare) (base_files, files_to_compare)
} }
fn compare_fingerprints(&mut self, stop_receiver: Option<&Receiver<()>>, atomic_counter: &Arc<AtomicUsize>) -> Option<Vec<Vec<MusicEntry>>> { fn compare_fingerprints(
&mut self,
stop_receiver: Option<&Receiver<()>>,
atomic_counter: &Arc<AtomicUsize>,
base_files: Vec<MusicEntry>,
files_to_compare: Vec<MusicEntry>,
) -> Option<Vec<Vec<MusicEntry>>> {
let mut used_paths: HashSet<String> = Default::default(); let mut used_paths: HashSet<String> = Default::default();
let (base_files, files_to_compare) = self.split_fingerprints_to_check();
let configuration = &self.hash_preset_config; let configuration = &self.hash_preset_config;
let minimum_segment_duration = self.minimum_segment_duration; let minimum_segment_duration = self.minimum_segment_duration;
let maximum_difference = self.maximum_difference; let maximum_difference = self.maximum_difference;
@ -767,82 +764,16 @@ impl SameMusic {
Some(duplicated_music_entries) Some(duplicated_music_entries)
} }
// fn compare_fingerprints(&mut self, stop_receiver: Option<&Receiver<()>>, atomic_counter: &Arc<AtomicUsize>) -> Option<Vec<Vec<MusicEntry>>> {
// // TODO do optimization
// // Multithreading
// // Grouping same hashes(not sure how common, but probably with a lot of files can save some time)
// // Better algorithm of finding similar fingerprints
//
// let mut used_paths: HashSet<String> = Default::default();
// let configuration = &self.hash_preset_config;
// let minimum_segment_duration = self.minimum_segment_duration;
// let maximum_difference = self.maximum_difference;
//
// let mut duplicated_music_entries = Vec::new();
//
// for (f_idx, f_entry) in self.music_entries.iter().enumerate() {
// if f_idx + 1 == self.music_entries.len() {
// break;
// }
//
// if stop_receiver.is_some() && stop_receiver.unwrap().try_recv().is_ok() {
// return None;
// }
// atomic_counter.fetch_add(1, Ordering::Relaxed);
//
// let f_string = f_entry.path.to_string_lossy().to_string();
// if used_paths.contains(&f_string) {
// continue;
// }
//
// let mut collected_similar_items = self.music_entries[f_idx + 1..]
// .par_iter()
// .filter_map(|e_entry| {
// let e_string = e_entry.path.to_string_lossy().to_string();
// if used_paths.contains(&e_string) {
// return None;
// }
// let mut segments = match_fingerprints(&f_entry.fingerprint, &e_entry.fingerprint, configuration).unwrap();
// segments.retain(|s| s.duration(configuration) > minimum_segment_duration && s.score < maximum_difference);
// if segments.is_empty() {
// None
// } else {
// Some((e_string, e_entry))
// }
// })
// .collect::<Vec<_>>();
//
// collected_similar_items.retain(|(path, _entry)| !used_paths.contains(path));
// if !collected_similar_items.is_empty() {
// let mut music_entries = Vec::new();
// for (path, entry) in collected_similar_items {
// used_paths.insert(path);
// music_entries.push(entry.clone());
// }
// used_paths.insert(f_string);
// music_entries.push(f_entry.clone());
// duplicated_music_entries.push(music_entries);
// }
// }
// Some(duplicated_music_entries)
// }
fn check_for_duplicate_fingerprints(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender<ProgressData>>) -> bool { fn check_for_duplicate_fingerprints(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender<ProgressData>>) -> bool {
assert_ne!(MusicSimilarity::NONE, self.music_similarity, "This can't be none"); assert_ne!(MusicSimilarity::NONE, self.music_similarity, "This can't be none");
let progress_thread_run = Arc::new(AtomicBool::new(true)); let progress_thread_run = Arc::new(AtomicBool::new(true));
let atomic_counter = Arc::new(AtomicUsize::new(0)); let atomic_counter = Arc::new(AtomicUsize::new(0));
let progress_thread_handle = prepare_thread_handler_common(
progress_sender,
&progress_thread_run,
&atomic_counter,
2,
2,
self.music_to_check.len(),
CheckingMethod::None,
);
let Some(duplicated_music_entries) = self.compare_fingerprints(stop_receiver, &atomic_counter) else { let (base_files, files_to_compare) = self.split_fingerprints_to_check();
let progress_thread_handle = prepare_thread_handler_common(progress_sender, &progress_thread_run, &atomic_counter, 2, 2, base_files.len(), self.check_type);
let Some(duplicated_music_entries) = self.compare_fingerprints(stop_receiver, &atomic_counter, base_files, files_to_compare) else {
send_info_and_wait_for_ending_all_threads(&progress_thread_run, progress_thread_handle); send_info_and_wait_for_ending_all_threads(&progress_thread_run, progress_thread_handle);
return false; return false;
}; };

View file

@ -446,6 +446,8 @@ progress_scanning_image = Hashing of {$file_checked}/{$all_files} image
progress_comparing_image_hashes = Comparing {$file_checked}/{$all_files} image hash progress_comparing_image_hashes = Comparing {$file_checked}/{$all_files} image hash
progress_scanning_music_tags_end = Comparing tags of {$file_checked}/{$all_files} music file progress_scanning_music_tags_end = Comparing tags of {$file_checked}/{$all_files} music file
progress_scanning_music_tags = Reading tags of {$file_checked}/{$all_files} music file progress_scanning_music_tags = Reading tags of {$file_checked}/{$all_files} music file
progress_scanning_music_content_end = Comparing fingerprint of {$file_checked}/{$all_files} music file
progress_scanning_music_content = Calculating fingerprint of {$file_checked}/{$all_files} music file
progress_scanning_empty_folders = Scanning {$folder_number} folder progress_scanning_empty_folders = Scanning {$folder_number} folder
progress_scanning_size = Scanning size of {$file_number} file progress_scanning_size = Scanning size of {$file_number} file
progress_scanning_size_name = Scanning name and size of {$file_number} file progress_scanning_size_name = Scanning name and size of {$file_number} file

View file

@ -1164,9 +1164,7 @@ fn computer_duplicate_finder(
duplicates_size = information.lost_space_by_size; duplicates_size = information.lost_space_by_size;
duplicates_group = information.number_of_groups_by_size_name; duplicates_group = information.number_of_groups_by_size_name;
} }
_ => { _ => panic!(),
panic!();
}
} }
if duplicates_size == 0 { if duplicates_size == 0 {
entry_info.set_text( entry_info.set_text(
@ -1251,9 +1249,7 @@ fn computer_duplicate_finder(
} }
} }
} }
_ => { _ => panic!(),
panic!();
}
} }
} else { } else {
match df.get_check_method() { match df.get_check_method() {
@ -1310,9 +1306,7 @@ fn computer_duplicate_finder(
} }
} }
} }
_ => { _ => panic!(),
panic!();
}
} }
} }
print_text_messages_to_text_view(text_messages, text_view_errors); print_text_messages_to_text_view(text_messages, text_view_errors);

View file

@ -1,9 +1,13 @@
use common_dir_traversal::CheckingMethod; use std::cell::RefCell;
use std::rc::Rc;
use futures::channel::mpsc::UnboundedReceiver; use futures::channel::mpsc::UnboundedReceiver;
use futures::StreamExt; use futures::StreamExt;
use glib::MainContext; use glib::MainContext;
use gtk4::prelude::*; use gtk4::prelude::*;
use gtk4::ProgressBar;
use common_dir_traversal::CheckingMethod;
use czkawka_core::common_dir_traversal; use czkawka_core::common_dir_traversal;
use czkawka_core::common_dir_traversal::ProgressData; use czkawka_core::common_dir_traversal::ProgressData;
@ -11,6 +15,7 @@ use crate::flg;
use crate::gui_structs::gui_data::GuiData; use crate::gui_structs::gui_data::GuiData;
use crate::localizer_core::generate_translation_hashmap; use crate::localizer_core::generate_translation_hashmap;
use crate::taskbar_progress::tbp_flags::TBPF_INDETERMINATE; use crate::taskbar_progress::tbp_flags::TBPF_INDETERMINATE;
use crate::taskbar_progress::TaskbarProgress;
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn connect_progress_window( pub fn connect_progress_window(
@ -102,44 +107,27 @@ fn process_bar_same_music(gui_data: &GuiData, main_context: &MainContext, mut fu
} }
1 => { 1 => {
progress_bar_current_stage.show(); progress_bar_current_stage.show();
if item.entries_to_check != 0 { common_set_data(&item, &progress_bar_all_stages, &progress_bar_current_stage, &taskbar_state);
progress_bar_all_stages.set_fraction((1f64 + (item.entries_checked) as f64 / item.entries_to_check as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction((item.entries_checked) as f64 / item.entries_to_check as f64); let translation_map = generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())]);
taskbar_state.borrow().set_progress_value( match item.checking_method {
(item.entries_to_check + item.entries_checked) as u64, CheckingMethod::AudioTags => label_stage.set_text(&flg!("progress_scanning_music_tags", translation_map)),
item.entries_to_check as u64 * (item.max_stage + 1) as u64, CheckingMethod::AudioContent => label_stage.set_text(&flg!("progress_scanning_music_content", translation_map)),
); _ => panic!(),
} else {
progress_bar_all_stages.set_fraction((1f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction(0f64);
taskbar_state.borrow().set_progress_value(1, (item.max_stage + 1) as u64);
} }
label_stage.set_text(&flg!(
"progress_scanning_music_tags",
generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())])
));
} }
2 => { 2 => {
if item.entries_to_check != 0 { common_set_data(&item, &progress_bar_all_stages, &progress_bar_current_stage, &taskbar_state);
progress_bar_all_stages.set_fraction((2f64 + (item.entries_checked) as f64 / item.entries_to_check as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction((item.entries_checked) as f64 / item.entries_to_check as f64); let translation_map = generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())]);
taskbar_state.borrow().set_progress_value(
(2 * item.entries_to_check + item.entries_checked) as u64, match item.checking_method {
item.entries_to_check as u64 * (item.max_stage + 1) as u64, CheckingMethod::AudioTags => label_stage.set_text(&flg!("progress_scanning_music_tags_end", translation_map)),
); CheckingMethod::AudioContent => label_stage.set_text(&flg!("progress_scanning_music_content_end", translation_map)),
} else { _ => panic!(),
progress_bar_all_stages.set_fraction((2f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction(0f64);
taskbar_state.borrow().set_progress_value(2, (item.max_stage + 1) as u64);
} }
label_stage.set_text(&flg!(
"progress_scanning_music_tags_end",
generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())])
));
}
_ => {
panic!();
} }
_ => panic!(),
} }
} }
}; };
@ -163,18 +151,7 @@ fn process_bar_similar_images(gui_data: &GuiData, main_context: &MainContext, mu
} }
1 => { 1 => {
progress_bar_current_stage.show(); progress_bar_current_stage.show();
if item.entries_to_check != 0 { common_set_data(&item, &progress_bar_all_stages, &progress_bar_current_stage, &taskbar_state);
progress_bar_all_stages.set_fraction((1f64 + (item.entries_checked) as f64 / item.entries_to_check as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction((item.entries_checked) as f64 / item.entries_to_check as f64);
taskbar_state.borrow().set_progress_value(
(item.entries_to_check + item.entries_checked) as u64,
item.entries_to_check as u64 * (item.max_stage + 1) as u64,
);
} else {
progress_bar_all_stages.set_fraction((item.current_stage as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction(0f64);
taskbar_state.borrow().set_progress_value(1, (item.max_stage + 1) as u64);
}
label_stage.set_text(&flg!( label_stage.set_text(&flg!(
"progress_scanning_image", "progress_scanning_image",
generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())]) generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())])
@ -182,26 +159,13 @@ fn process_bar_similar_images(gui_data: &GuiData, main_context: &MainContext, mu
} }
2 => { 2 => {
progress_bar_current_stage.show(); progress_bar_current_stage.show();
if item.entries_to_check != 0 { common_set_data(&item, &progress_bar_all_stages, &progress_bar_current_stage, &taskbar_state);
progress_bar_all_stages.set_fraction((2f64 + (item.entries_checked) as f64 / item.entries_to_check as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction((item.entries_checked) as f64 / item.entries_to_check as f64);
taskbar_state.borrow().set_progress_value(
(item.entries_to_check + item.entries_checked) as u64,
item.entries_to_check as u64 * (item.max_stage + 1) as u64,
);
} else {
progress_bar_all_stages.set_fraction((item.current_stage as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction(0f64);
taskbar_state.borrow().set_progress_value(2, (item.max_stage + 1) as u64);
}
label_stage.set_text(&flg!( label_stage.set_text(&flg!(
"progress_comparing_image_hashes", "progress_comparing_image_hashes",
generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())]) generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())])
)); ));
} }
_ => { _ => panic!(),
panic!();
}
} }
} }
}; };
@ -225,26 +189,13 @@ fn process_bar_similar_videos(gui_data: &GuiData, main_context: &MainContext, mu
} }
1 => { 1 => {
progress_bar_current_stage.show(); progress_bar_current_stage.show();
if item.entries_to_check != 0 { common_set_data(&item, &progress_bar_all_stages, &progress_bar_current_stage, &taskbar_state);
progress_bar_all_stages.set_fraction((1f64 + (item.entries_checked) as f64 / item.entries_to_check as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction((item.entries_checked) as f64 / item.entries_to_check as f64);
taskbar_state.borrow().set_progress_value(
(item.entries_to_check + item.entries_checked) as u64,
item.entries_to_check as u64 * (item.max_stage + 1) as u64,
);
} else {
progress_bar_all_stages.set_fraction((1f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction(0f64);
taskbar_state.borrow().set_progress_value(1, (item.max_stage + 1) as u64);
}
label_stage.set_text(&flg!( label_stage.set_text(&flg!(
"progress_scanning_video", "progress_scanning_video",
generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())]) generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())])
)); ));
} }
_ => { _ => panic!(),
panic!();
}
} }
} }
}; };
@ -296,26 +247,13 @@ fn process_bar_broken_files(gui_data: &GuiData, main_context: &MainContext, mut
} }
1 => { 1 => {
progress_bar_current_stage.show(); progress_bar_current_stage.show();
if item.entries_to_check != 0 { common_set_data(&item, &progress_bar_all_stages, &progress_bar_current_stage, &taskbar_state);
progress_bar_all_stages.set_fraction((1f64 + (item.entries_checked) as f64 / item.entries_to_check as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction((item.entries_checked) as f64 / item.entries_to_check as f64);
taskbar_state.borrow().set_progress_value(
(item.entries_to_check + item.entries_checked) as u64,
item.entries_to_check as u64 * (item.max_stage + 1) as u64,
);
} else {
progress_bar_all_stages.set_fraction((1f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction(0f64);
taskbar_state.borrow().set_progress_value(1, (item.max_stage + 1) as u64);
}
label_stage.set_text(&flg!( label_stage.set_text(&flg!(
"progress_scanning_broken_files", "progress_scanning_broken_files",
generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())]) generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())])
)); ));
} }
_ => { _ => panic!(),
panic!();
}
} }
} }
}; };
@ -339,26 +277,13 @@ fn process_bar_bad_extensions(gui_data: &GuiData, main_context: &MainContext, mu
} }
1 => { 1 => {
progress_bar_current_stage.show(); progress_bar_current_stage.show();
if item.entries_to_check != 0 { common_set_data(&item, &progress_bar_all_stages, &progress_bar_current_stage, &taskbar_state);
progress_bar_all_stages.set_fraction((1f64 + (item.entries_checked) as f64 / item.entries_to_check as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction((item.entries_checked) as f64 / item.entries_to_check as f64);
taskbar_state.borrow().set_progress_value(
(item.entries_to_check + item.entries_checked) as u64,
item.entries_to_check as u64 * (item.max_stage + 1) as u64,
);
} else {
progress_bar_all_stages.set_fraction((1f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction(0f64);
taskbar_state.borrow().set_progress_value(1, (item.max_stage + 1) as u64);
}
label_stage.set_text(&flg!( label_stage.set_text(&flg!(
"progress_scanning_extension_of_files", "progress_scanning_extension_of_files",
generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())]) generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())])
)); ));
} }
_ => { _ => panic!(),
panic!();
}
} }
} }
}; };
@ -391,18 +316,7 @@ fn process_bar_duplicates(gui_data: &GuiData, main_context: &MainContext, mut fu
1 => { 1 => {
progress_bar_current_stage.show(); progress_bar_current_stage.show();
// progress_bar_all_stages.show(); // progress_bar_all_stages.show();
if item.entries_to_check != 0 { common_set_data(&item, &progress_bar_all_stages, &progress_bar_current_stage, &taskbar_state);
progress_bar_all_stages.set_fraction((1f64 + (item.entries_checked) as f64 / item.entries_to_check as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction((item.entries_checked) as f64 / item.entries_to_check as f64);
taskbar_state.borrow().set_progress_value(
(item.entries_to_check + item.entries_checked) as u64,
item.entries_to_check as u64 * (item.max_stage + 1) as u64,
);
} else {
progress_bar_all_stages.set_fraction((1f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction(0f64);
taskbar_state.borrow().set_progress_value(1, 1 + item.max_stage as u64);
}
label_stage.set_text(&flg!( label_stage.set_text(&flg!(
"progress_analyzed_partial_hash", "progress_analyzed_partial_hash",
@ -411,19 +325,7 @@ fn process_bar_duplicates(gui_data: &GuiData, main_context: &MainContext, mut fu
} }
// Hash - normal hash // Hash - normal hash
2 => { 2 => {
if item.entries_to_check != 0 { common_set_data(&item, &progress_bar_all_stages, &progress_bar_current_stage, &taskbar_state);
progress_bar_all_stages.set_fraction((2f64 + (item.entries_checked) as f64 / item.entries_to_check as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction((item.entries_checked) as f64 / item.entries_to_check as f64);
taskbar_state.borrow().set_progress_value(
(2 * item.entries_to_check + item.entries_checked) as u64,
item.entries_to_check as u64 * (item.max_stage + 1) as u64,
);
} else {
progress_bar_all_stages.set_fraction((2f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction(0f64);
taskbar_state.borrow().set_progress_value(2, 1 + item.max_stage as u64);
}
label_stage.set_text(&flg!( label_stage.set_text(&flg!(
"progress_analyzed_full_hash", "progress_analyzed_full_hash",
generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())]) generate_translation_hashmap(vec![("file_checked", item.entries_checked.to_string()), ("all_files", item.entries_to_check.to_string())])
@ -470,3 +372,18 @@ fn process_bar_duplicates(gui_data: &GuiData, main_context: &MainContext, mut fu
}; };
main_context.spawn_local(future); main_context.spawn_local(future);
} }
fn common_set_data(item: &ProgressData, progress_bar_all_stages: &ProgressBar, progress_bar_current_stage: &ProgressBar, taskbar_state: &Rc<RefCell<TaskbarProgress>>) {
if item.entries_to_check != 0 {
progress_bar_all_stages.set_fraction((item.current_stage as f64 + (item.entries_checked) as f64 / item.entries_to_check as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction((item.entries_checked) as f64 / item.entries_to_check as f64);
taskbar_state.borrow().set_progress_value(
((item.current_stage as usize) * item.entries_to_check + item.entries_checked) as u64,
item.entries_to_check as u64 * (item.max_stage + 1) as u64,
);
} else {
progress_bar_all_stages.set_fraction((item.current_stage as f64) / (item.max_stage + 1) as f64);
progress_bar_current_stage.set_fraction(0f64);
taskbar_state.borrow().set_progress_value(item.current_stage as u64, 1 + item.max_stage as u64);
}
}