[BE][Scans] Fixes #29: Don't throw error if a QR is not found

This commit is contained in:
Araozu 2023-11-30 14:25:45 -05:00
parent cead15a33d
commit 576ba579b7
2 changed files with 20 additions and 126 deletions

View File

@ -189,7 +189,6 @@ fn get_image_info(path: PathBuf) -> ScanInfo {
// if the image is not thresholded, it may fail more often // if the image is not thresholded, it may fail more often
let results = bardecoder::default_decoder().decode(&thresholded_image); let results = bardecoder::default_decoder().decode(&thresholded_image);
// If no QR is detected, only rename // If no QR is detected, only rename
if results.is_empty() { if results.is_empty() {
log::info!("QR not found"); log::info!("QR not found");
@ -212,7 +211,8 @@ fn get_image_info(path: PathBuf) -> ScanInfo {
Ok(url) => url, Ok(url) => url,
Err(reason) => { Err(reason) => {
log::error!("Error decoding qr: {:?}", reason); log::error!("Error decoding qr: {:?}", reason);
return ScanInfo::Error("Error recuperando QR.".into()); // Here there was a problem aligning the QR. Assume no QR
return ScanInfo::Empty(current_ms.to_string());
} }
}; };
@ -274,7 +274,6 @@ fn get_image_info(path: PathBuf) -> ScanInfo {
} }
} }
/// Converts a list of files into PDFs. /// Converts a list of files into PDFs.
/// ///
/// Uses the timestamps inside `data` to read the correct JPG files and convert them. /// Uses the timestamps inside `data` to read the correct JPG files and convert them.
@ -415,8 +414,8 @@ fn convert_to_pdf(image_path: &PathBuf, output_path: &PathBuf) -> Result<(), Str
.arg("0.05") .arg("0.05")
.arg("-quality") .arg("-quality")
.arg("75%") .arg("75%")
// .arg("-rotate") .arg("-rotate")
// .arg("270") .arg("270")
.arg(image_path) .arg(image_path)
.arg(output_path) .arg(output_path)
.spawn(); .spawn();

File diff suppressed because one or more lines are too long