resize _all_ of the covers, not just the root
This commit is contained in:
parent
aca297e7de
commit
955f5833cc
2 changed files with 8 additions and 3 deletions
|
@ -159,8 +159,12 @@ fn generate_images(config: &Config, album: &AlbumDir, full: bool) -> anyhow::Res
|
||||||
let output_path = album.path.join(&config.output_dir);
|
let output_path = album.path.join(&config.output_dir);
|
||||||
let mut all_images: Vec<&Image> = album.iter_all_images().collect();
|
let mut all_images: Vec<&Image> = album.iter_all_images().collect();
|
||||||
|
|
||||||
// also resize cover image
|
// also resize cover images, since we didn't count those as part of the image collections
|
||||||
|
let mut album_queue: VecDeque<&AlbumDir> = VecDeque::from([album]);
|
||||||
|
while let Some(album) = album_queue.pop_front() {
|
||||||
all_images.push(&album.cover);
|
all_images.push(&album.cover);
|
||||||
|
album_queue.extend(&album.children);
|
||||||
|
}
|
||||||
|
|
||||||
println!("Generating images...");
|
println!("Generating images...");
|
||||||
let progress = ProgressBar::new(all_images.len() as u64);
|
let progress = ProgressBar::new(all_images.len() as u64);
|
||||||
|
|
|
@ -46,6 +46,7 @@ impl AlbumDir {
|
||||||
pulldown_cmark::html::push_html(&mut description, parser);
|
pulldown_cmark::html::push_html(&mut description, parser);
|
||||||
} else {
|
} else {
|
||||||
if filename.to_string_lossy().starts_with("cover") {
|
if filename.to_string_lossy().starts_with("cover") {
|
||||||
|
log::debug!("Found explicit cover for {}", p.display());
|
||||||
cover = Some(Image::new(
|
cover = Some(Image::new(
|
||||||
entry_path.strip_prefix(root)?.to_path_buf(),
|
entry_path.strip_prefix(root)?.to_path_buf(),
|
||||||
String::new(),
|
String::new(),
|
||||||
|
@ -112,7 +113,7 @@ impl AlbumDir {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let cover = cover.ok_or(anyhow!("Could not find a cover image for {}", p.display()))?;
|
let cover = cover.ok_or(anyhow!("Could not find a cover image for {}", p.display()))?;
|
||||||
log::debug!("Cover for {} is {cover:?}", p.display());
|
log::debug!("Cover for {} is {}", p.display(), cover.path.display());
|
||||||
|
|
||||||
Ok(AlbumDir {
|
Ok(AlbumDir {
|
||||||
path: p.strip_prefix(root)?.to_path_buf(),
|
path: p.strip_prefix(root)?.to_path_buf(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue