summaryrefslogtreecommitdiff
path: root/src/files.rs
diff options
context:
space:
mode:
authorjakka <jakkadoujin@gmail.com>2025-06-19 16:13:12 +0300
committerjakka <jakkadoujin@gmail.com>2025-06-19 16:13:12 +0300
commitfda50928e2e2f46c1dea45527c1277906a208c2a (patch)
tree6019703d402bde8351f10f27d48d0fbbe0fcde3b /src/files.rs
parentbef69b312cb9d5b2d03984caf492ce8ce16bff18 (diff)
cleaned up a bit
Diffstat (limited to 'src/files.rs')
-rw-r--r--src/files.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/files.rs b/src/files.rs
index 79d0499..171b866 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -13,11 +13,7 @@ use walkdir::WalkDir;
use crate::{db::Database, flac::encode_file};
-const INDEXBAR_TEMPLATE: &str =
- "{msg} [{wide_bar:.green/cyan}] Elapsed: {elapsed} {pos:>7}/{len:7}";
-
-const REENCODEBAR_TEMPLATE: &str =
- "{msg} [{wide_bar:.green/cyan}] Elapsed: {elapsed} {pos:>7}/{len:7}";
+const BAR_TEMPLATE: &str = "{msg} [{wide_bar:.green/cyan}] Elapsed: {elapsed} {pos:>7}/{len:7}";
#[derive(Debug)]
pub struct FileError {
@@ -38,7 +34,7 @@ impl Display for FileError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
- "error: {}\t on file {}",
+ "error: {}\ton file {}",
self.error,
self.file.to_string_lossy()
)
@@ -84,7 +80,7 @@ pub async fn index_files_recursively(path: impl AsRef<Path>, conn: &Database) ->
let mut tasks = JoinSet::new();
let bar = ProgressBar::new(0)
- .with_style(ProgressStyle::with_template(INDEXBAR_TEMPLATE)?.progress_chars("#>-"))
+ .with_style(ProgressStyle::with_template(BAR_TEMPLATE)?.progress_chars("#>-"))
.with_message("Indexing");
let _ = WalkDir::new(abspath)
@@ -124,7 +120,7 @@ pub async fn reencode_files(conn: &Database) -> Result<()> {
let mut tasks = JoinSet::new();
let bar = ProgressBar::new(conn.get_toencode_number().await?)
- .with_style(ProgressStyle::with_template(REENCODEBAR_TEMPLATE)?.progress_chars("#>-"))
+ .with_style(ProgressStyle::with_template(BAR_TEMPLATE)?.progress_chars("#>-"))
.with_message("Reencoding");
while let Some(Ok(row)) = stream.next().await {