mirror of
https://github.com/agersant/polaris
synced 2024-12-03 10:09:09 +00:00
Cleanup
This commit is contained in:
parent
120ee72e1d
commit
d894ae2783
2 changed files with 4 additions and 3 deletions
|
@ -476,7 +476,9 @@ fn test_preferences_read_write() {
|
||||||
};
|
};
|
||||||
amend(&db, &initial_config).unwrap();
|
amend(&db, &initial_config).unwrap();
|
||||||
|
|
||||||
let new_preferences = Preferences {};
|
let new_preferences = Preferences {
|
||||||
|
lastfm_username: None,
|
||||||
|
};
|
||||||
write_preferences(&db, "Teddy🐻", &new_preferences).unwrap();
|
write_preferences(&db, "Teddy🐻", &new_preferences).unwrap();
|
||||||
|
|
||||||
let read_preferences = read_preferences(&db, "Teddy🐻").unwrap();
|
let read_preferences = read_preferences(&db, "Teddy🐻").unwrap();
|
||||||
|
|
|
@ -41,7 +41,7 @@ pub fn get_thumbnail(real_path: &Path, max_dimension: u32) -> Result<PathBuf> {
|
||||||
out_path.push(format!("{}.jpg", hash.to_string()));
|
out_path.push(format!("{}.jpg", hash.to_string()));
|
||||||
|
|
||||||
if !out_path.exists() {
|
if !out_path.exists() {
|
||||||
let quality = 95;
|
let quality = 80;
|
||||||
let source_aspect_ratio: f32 = source_width as f32 / source_height as f32;
|
let source_aspect_ratio: f32 = source_width as f32 / source_height as f32;
|
||||||
|
|
||||||
let mut final_image;
|
let mut final_image;
|
||||||
|
@ -62,7 +62,6 @@ pub fn get_thumbnail(real_path: &Path, max_dimension: u32) -> Result<PathBuf> {
|
||||||
(out_dimension - scaled_width) / 2,
|
(out_dimension - scaled_width) / 2,
|
||||||
(out_dimension - scaled_height) / 2,
|
(out_dimension - scaled_height) / 2,
|
||||||
);
|
);
|
||||||
final_image.write_to(&mut out_file, ImageOutputFormat::JPEG(quality))?;
|
|
||||||
} else {
|
} else {
|
||||||
final_image =
|
final_image =
|
||||||
source_image.resize_exact(out_dimension, out_dimension, FilterType::Lanczos3);
|
source_image.resize_exact(out_dimension, out_dimension, FilterType::Lanczos3);
|
||||||
|
|
Loading…
Reference in a new issue