Skip to content

Commit

Permalink
Small fixes (#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
qarmin authored Jul 28, 2022
1 parent d5b0878 commit bf9dd35
Show file tree
Hide file tree
Showing 21 changed files with 391 additions and 52 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
toolchain: [ stable ]
type: [ release ]
runs-on: macos-10.15
runs-on: macos-latest
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
matrix:
toolchain: [ stable ]
type: [ release ]
runs-on: macos-10.15
runs-on: macos-latest
steps:
- uses: actions/checkout@v2

Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
- Fix disabled ui when using invalid settings in similar music - [#740](https://github.com/qarmin/czkawka/pull/740)
- Speedup searching for invalid extensions - [#740](https://github.com/qarmin/czkawka/pull/740)
- Support for finding the smallest files - [#741](https://github.com/qarmin/czkawka/pull/741)
- Improve Windows CI - [#749](https://github.com/qarmin/czkawka/pull/749)
- Improved Windows CI - [#749](https://github.com/qarmin/czkawka/pull/749)
- Ability to check for broken files by types - [#749](https://github.com/qarmin/czkawka/pull/749)
- Add heif and Webp files support - [#750](https://github.com/qarmin/czkawka/pull/750)
- Use in CLI Clap library instead StructOpt - [#759](https://github.com/qarmin/czkawka/pull/759)
- Multiple directories can be added via Manual Add button - [#782](https://github.com/qarmin/czkawka/pull/782)
- Option to exclude files from other filesystems in GUI(Linux) - [#776](https://github.com/qarmin/czkawka/pull/776)

## Version 4.1.0 - 24.04.2022r
- New mode - finding files whose content not match with their extension - [#678](https://github.com/qarmin/czkawka/pull/678)
Expand Down
48 changes: 25 additions & 23 deletions czkawka_core/src/broken_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use pdf::PdfError::Try;
use rayon::prelude::*;
use serde::{Deserialize, Serialize};

use crate::common::{open_cache_folder, Common, LOOP_DURATION, PDF_FILES_EXTENSIONS};
use crate::common::{create_crash_message, open_cache_folder, Common, LOOP_DURATION, PDF_FILES_EXTENSIONS};
use crate::common::{AUDIO_FILES_EXTENSIONS, IMAGE_RS_BROKEN_FILES_EXTENSIONS, ZIP_FILES_EXTENSIONS};
use crate::common_directory::Directories;
use crate::common_extensions::Extensions;
Expand Down Expand Up @@ -477,8 +477,9 @@ impl BrokenFiles {
if let Ok(image_result) = result {
image_result
} else {
println!("Image-rs library crashed when opening \"{:?}\" image, please check if problem happens with latest image-rs version(this can be checked via https://github.com/qarmin/ImageOpening tool) and if it is not reported, please report bug here - https://github.com/image-rs/image/issues", file_entry_clone.path);
file_entry_clone.error_string = "Image crashes due parsing, please check if problem happens with updated https://github.com/qarmin/ImageOpening and later report here https://github.com/image-rs/image/issues".to_string();
let message = create_crash_message("Image-rs", &file_entry_clone.path.to_string_lossy().to_string(), "https://github.com/Serial-ATA/lofty-rs");
println!("{message}");
file_entry_clone.error_string = message;
Some(Some(file_entry_clone))
}
}
Expand All @@ -489,28 +490,28 @@ impl BrokenFiles {
}
Some(Some(file_entry))
}
Err(_inspected) => Some(None)
Err(_inspected) => Some(None),
},
TypeOfFile::Audio => match File::open(&file_entry.path) {
Ok(file) =>
{
let mut file_entry_clone = file_entry.clone();

let result = panic::catch_unwind(|| {
if let Err(e) = audio_checker::parse_audio_file(file) {
file_entry.error_string = e.to_string();
}
Some(Some(file_entry))
});
Ok(file) => {
let mut file_entry_clone = file_entry.clone();

if let Ok(audio_result) = result {
audio_result
} else {
println!("External parsing audio library crashed when opening \"{:?}\" audio file, please report bug here - https://github.com/qarmin/audio_checker/issues", file_entry_clone.path);
file_entry_clone.error_string = "Audio crashes due parsing, please report bug here - https://github.com/qarmin/audio_checker/issues".to_string();
Some(Some(file_entry_clone))
let result = panic::catch_unwind(|| {
if let Err(e) = audio_checker::parse_audio_file(file) {
file_entry.error_string = e.to_string();
}
Some(Some(file_entry))
});

if let Ok(audio_result) = result {
audio_result
} else {
let message = create_crash_message("Symphonia", &file_entry_clone.path.to_string_lossy().to_string(), "https://github.com/pdeljanov/Symphonia");
println!("{message}");
file_entry_clone.error_string = message;
Some(Some(file_entry_clone))
}
}
Err(_inspected) => Some(None),
},

Expand Down Expand Up @@ -540,12 +541,13 @@ impl BrokenFiles {
if let Ok(pdf_result) = result {
pdf_result
} else {
println!("PDF-rs library crashed when opening \"{:?}\" pdf, and if it is not reported, please report bug here - https://github.com/pdf-rs/pdf", file_entry_clone.path);
file_entry_clone.error_string = "PDF-rs library crashed when opening pdf, and if it is not reported, please report bug here - https://github.com/pdf-rs/pdf".to_string();
let message = create_crash_message("PDF-rs", &file_entry_clone.path.to_string_lossy().to_string(), "https://github.com/pdf-rs/pdf");
println!("{message}");
file_entry_clone.error_string = message;
Some(Some(file_entry_clone))
}
}
Err(_inspected) => Some(None)
Err(_inspected) => Some(None),
}
}

Expand Down
4 changes: 4 additions & 0 deletions czkawka_core/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ pub fn split_path(path: &Path) -> (String, String) {
}
}

pub fn create_crash_message(library_name: &str, file_path: &str, home_library_url: &str) -> String {
format!("{library_name} library crashed when opening \"{file_path}\", please check if this is fixed with the latest version of {library_name} (e.g. with https://github.com/qarmin/crates_tester) and if it is not fixed, please report bug here - {home_library_url}")
}

impl Common {
/// Printing time which took between start and stop point and prints also function name
#[allow(unused_variables)]
Expand Down
5 changes: 3 additions & 2 deletions czkawka_core/src/same_music.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use lofty::{read_from, AudioFile, ItemKey};
use rayon::prelude::*;
use serde::{Deserialize, Serialize};

use crate::common::AUDIO_FILES_EXTENSIONS;
use crate::common::{create_crash_message, AUDIO_FILES_EXTENSIONS};
use crate::common::{open_cache_folder, Common, LOOP_DURATION};
use crate::common_dir_traversal::{CheckingMethod, DirTraversalBuilder, DirTraversalResult, FileEntry, ProgressData};
use crate::common_directory::Directories;
Expand Down Expand Up @@ -393,7 +393,8 @@ impl SameMusic {
}
},
Err(_) => {
println!("File {} crashed during reading tags, please report bug", path);
let message = create_crash_message("Lofty", &path, "https://github.com/image-rs/image/issues");
println!("{message}");
return Some(None);
}
};
Expand Down
10 changes: 6 additions & 4 deletions czkawka_core/src/similar_images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ use serde::{Deserialize, Serialize};

#[cfg(feature = "heif")]
use crate::common::get_dynamic_image_from_heic;
use crate::common::{get_dynamic_image_from_raw_image, open_cache_folder, Common, HEIC_EXTENSIONS, IMAGE_RS_SIMILAR_IMAGES_EXTENSIONS, LOOP_DURATION, RAW_IMAGE_EXTENSIONS};
use crate::common::{
create_crash_message, get_dynamic_image_from_raw_image, open_cache_folder, Common, HEIC_EXTENSIONS, IMAGE_RS_SIMILAR_IMAGES_EXTENSIONS, LOOP_DURATION, RAW_IMAGE_EXTENSIONS,
};
use crate::common_directory::Directories;
use crate::common_extensions::Extensions;
use crate::common_items::ExcludedItems;
Expand Down Expand Up @@ -563,8 +565,7 @@ impl SimilarImages {
if RAW_IMAGE_EXTENSIONS.iter().any(|e| file_name_lowercase.ends_with(e)) {
image = match get_dynamic_image_from_raw_image(&file_entry.path) {
Some(t) => t,
None =>
return Some(Some((file_entry, Vec::new())))
None => return Some(Some((file_entry, Vec::new()))),
};
break 'krztyna;
}
Expand Down Expand Up @@ -599,7 +600,8 @@ impl SimilarImages {
return Some(Some((file_entry, Vec::new())));
}
} else {
println!("Image-rs library crashed when opening \"{:?}\" image, please check if problem happens with latest image-rs version(this can be checked via https://github.com/qarmin/ImageOpening tool) and if it is not reported, please report bug here - https://github.com/image-rs/image/issues", file_entry.path);
let message = create_crash_message("Image-rs", &file_entry.path.to_string_lossy().to_string(), "https://github.com/image-rs/image/issues");
println!("{message}");
return Some(Some((file_entry, Vec::new())));
}

Expand Down
106 changes: 105 additions & 1 deletion czkawka_gui/icons/czk_hide_down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit bf9dd35

Please sign in to comment.