diff --git a/Cargo.toml b/Cargo.toml index dea9e1a..0ff1ae5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,7 @@ avif-serialize = "0.8.1" notify-rust = { version = "4.8.0", features = ["images"] } thread-priority = "0.13.1" notify = "6.0.1" + [profile.release] lto = false opt-level = 3 diff --git a/PKGBUILD b/PKGBUILD index ba9b6db..d9b084e 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,5 +1,5 @@ pkgname=avif-converter-git -pkgver=1.9.1 +pkgver=1.10.1 pkgrel=1 source=("git+https://github.com/FerrahWolfeh/avif-converter.git") sha256sums=('SKIP') diff --git a/services/aviffolder.desktop b/services/aviffolder.desktop index 7d3ebb8..4b146f6 100755 --- a/services/aviffolder.desktop +++ b/services/aviffolder.desktop @@ -8,14 +8,14 @@ X-KDE-Submenu=AVIF [Desktop Action avif-custom] Name=AVIF Icon=image -Exec=File=%u ; avif-converter -N --quiet -q 80 -s 2 "$File" +Exec=File=%u ; avif-converter avif -N --quiet -q 80 -s 2 "$File" [Desktop Action avif-preserve] Name=AVIF (keep old files) Icon=image -Exec=File=%u ; avif-converter -N --quiet -q 80 -s 2 -k "$File" +Exec=File=%u ; avif-converter avif -N --quiet -q 80 -s 2 -k "$File" [Desktop Action avif-name] Name=AVIF (keep names) Icon=image -Exec=File=%u ; avif-converter -N --quiet -q 80 -s 2 -n same "$File" +Exec=File=%u ; avif-converter avif -N --quiet -q 80 -s 2 -n same "$File" diff --git a/src/cli/commands/watch.rs b/src/cli/commands/watch.rs index 5a75605..38faca8 100644 --- a/src/cli/commands/watch.rs +++ b/src/cli/commands/watch.rs @@ -8,7 +8,7 @@ use std::{ }; use threadpool::ThreadPool; -use crate::{cli::Args as Globals, image_file::ImageFile, utils::sys_threads}; +use crate::{cli::Args as Globals, image_file::ImageFile, utils::{sys_threads, truncate_str}}; use clap::Args; #[derive(Args, Debug, Clone)] @@ -82,8 +82,8 @@ impl Watch { image.save_avif(None, globals.name_type, globals.keep)?; info!( - "File '{:.32}' encode finished. {} -> {} ({:?})", - image.metadata.filename, + "File '{}' encode finished. {} -> {} ({:?})", + truncate_str(&image.metadata.filename, 32), ByteSize::b(image_size).to_string_as(true), ByteSize::b(fsz).to_string_as(true), start.elapsed() diff --git a/src/utils.rs b/src/utils.rs index 50a6c99..d716db8 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -63,3 +63,15 @@ pub fn calculate_tread_count(num_threads: usize, num_items: usize) -> ThreadCoun spawn_threads: sel_thread_count, } } + +pub fn truncate_str(str: &str, size: usize) -> String { + assert!(str.len() > 3); + + if str.len() <= size { + return str.to_string() + } + + let mut truncated = str[..size].to_string(); + truncated.push_str("..."); + truncated +} \ No newline at end of file