Skip to content

Commit 1f35502

Browse files
committed
Add custom description and styling for progress bar
1 parent 8667ac3 commit 1f35502

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/fileio.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::path::Path;
88
use std::sync::mpsc::channel;
99
use std::sync::{Arc, Mutex};
1010
use threadpool::ThreadPool;
11-
use tqdm::{pbar, Pbar};
11+
use tqdm;
1212

1313
/// Function to retrieve the value of a key from a plist file
1414
///
@@ -58,14 +58,18 @@ pub fn parse_manifest_db(
5858

5959
// Get count to update progress bar
6060
let mut count_stmt = conn.prepare(&format!(
61-
"SELECT COUNT(*) FROM Files {}'",
61+
"SELECT COUNT(*) FROM Files {}",
6262
squire::media_filter()
6363
))?;
6464
let count: usize = count_stmt.query_row([], |row| row.get(0))?;
65-
let progress_bar_base: Arc<Mutex<Pbar>> = Arc::new(Mutex::new(pbar(Some(count))));
65+
let progress_bar_base = Arc::new(Mutex::new(
66+
tqdm::tqdm(0..count)
67+
.desc(Some("Extracting"))
68+
.style(tqdm::Style::Block),
69+
));
6670

6771
let mut stmt = conn.prepare(&format!(
68-
"SELECT fileID, relativePath FROM Files {}'",
72+
"SELECT fileID, relativePath FROM Files {}",
6973
squire::media_filter()
7074
))?;
7175
let rows = stmt.query_map([], |row| {
@@ -91,7 +95,7 @@ pub fn parse_manifest_db(
9195
sender_cloned.send(result).expect("Failed to send result");
9296
// Safely update progress bar
9397
let mut progress = progress_bar.lock().unwrap();
94-
progress.update(1).unwrap();
98+
progress.pbar.update(1).unwrap();
9599
});
96100
}
97101
Err(err) => {

0 commit comments

Comments
 (0)