1
0
Fork 0
mirror of synced 2024-04-27 17:22:13 +12:00

Add checking for broken music opt-in (#249)

This commit is contained in:
Rafał Mikrut 2021-02-05 19:07:20 +01:00 committed by GitHub
parent 3ffa55b008
commit 9bb574235a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 6 deletions

View file

@ -107,14 +107,14 @@ sudo snap connect czkawka:removable-media
The Snap store entry can be found [**here**](https://snapcraft.io/czkawka).
Fresh builds are available in edge branch, but they may be a little unstable, although that happenes very rarely
Fresh builds are available in edge branch, but they may be a little unstable, although that happens very rarely
because I don't push untested code.
### Flatpak
```
flatpak install flathub com.github.qarmin.czkawka
```
Czkawka can be found here - https://flathub.org/apps/details/com.github.qarmin.czkawka
Flathub page with Czkawka can be found [**here**](https://flathub.org/apps/details/com.github.qarmin.czkawka)
### Debian/Ubuntu repository and PPA
I tried to set up it, but I'm having problems described in this [**issue**](https://salsa.debian.org/rust-team/debcargo-conf/-/issues/21).
@ -191,19 +191,28 @@ After that the latest GTK 3 runtime must be installed from https://github.com/ts
git clone https://github.com/qarmin/czkawka.git
cd czkawka
```
- Run GTK GUI
- Compile and run GTK GUI
```
cargo run --bin czkawka_gui
```
For Linux-to-Windows cross-building instruction look at the CI.
![GUI](https://user-images.githubusercontent.com/41945903/103371136-fb9cae80-4ace-11eb-8d72-7b4c8ac44260.png)
- Run CLI (this will print help with a lot of examples)
- Compile and run CLI (this will print help with a lot of examples)
```
cargo run --bin czkawka_cli
```
![CLI](https://user-images.githubusercontent.com/41945903/93716816-0bbcfd80-fb72-11ea-8d31-4c87cc2abe6d.png)
### Additional features
For now, finding broken audio files is temporary disabled by default, because it crash when not found audio libraries on computer.
I'm waiting for ability to disable audio playback feature, so after that I will be able to reenable by default this feature (https://github.com/RustAudio/rodio/issues/349)
To enable checking for broken audio files, just add at the end ` --all-features`
```
cargo run --all-features --bin czkawka_cli -- broken -d /home/rafal/ -f "results.txt"
```
<!-- End of compilation section -->

View file

@ -32,9 +32,14 @@ futures = "0.3.9"
# Needed by broken files
zip = "0.5.9"
rodio = "0.13.0"
rodio = { version = "0.13.0", optional = true }
# Hashes
blake3 = "0.3"
crc32fast = "1.2.1"
xxhash-rust = { version = "0.8.1", features = ["xxh3"] }
[features]
default = []
broken_audio = ["rodio"]

View file

@ -49,6 +49,7 @@ pub enum TypeOfFile {
Unknown = -1,
Image = 0,
ArchiveZIP,
#[cfg(feature = "broken_audio")]
Audio,
}
@ -390,6 +391,7 @@ impl BrokenFiles {
},
Err(_) => Some(None),
},
#[cfg(feature = "broken_audio")]
TypeOfFile::Audio => match fs::File::open(&file_entry.path) {
Ok(file) => match rodio::Decoder::new(BufReader::new(file)) {
Ok(_) => Some(None),
@ -671,7 +673,15 @@ fn check_extension_avaibility(file_name_lowercase: &str) -> TypeOfFile {
} else if allowed_archive_zip_extensions.iter().any(|e| file_name_lowercase.ends_with(e)) {
TypeOfFile::ArchiveZIP
} else if allowed_audio_extensions.iter().any(|e| file_name_lowercase.ends_with(e)) {
TypeOfFile::Audio
#[cfg(feature = "broken_audio")]
{
TypeOfFile::Audio
}
#[cfg(not(feature = "broken_audio"))]
{
TypeOfFile::Unknown
}
} else {
TypeOfFile::Unknown
}