feat: enhance thumbnail management with full rebuild functionality

- Extend thumbnail regeneration logic to support full rebuilds, allowing for the deletion of orphaned thumbnails.
- Implement database updates to clear thumbnail paths for books during regeneration and full rebuild processes.
- Improve logging to provide detailed insights on the number of deleted thumbnails and cleared database entries.
- Refactor code for better organization and clarity in handling thumbnail files.
This commit is contained in:
2026-03-08 21:10:34 +01:00
parent 9c7120c3dc
commit 539dc77d57
2 changed files with 72 additions and 7 deletions

View File

@@ -9,7 +9,7 @@ use serde::Serialize;
use sha2::{Digest, Sha256};
use sqlx::{postgres::PgPoolOptions, Row};
use std::{collections::HashMap, path::Path, time::Duration};
use stripstream_core::config::{IndexerConfig, ThumbnailConfig};
use stripstream_core::config::IndexerConfig;
use tokio::sync::mpsc;
use tracing::{error, info, trace, warn};
use uuid::Uuid;
@@ -38,7 +38,6 @@ struct AppState {
pool: sqlx::PgPool,
meili_url: String,
meili_master_key: String,
thumbnail_config: ThumbnailConfig,
api_base_url: String,
api_bootstrap_token: String,
}
@@ -69,7 +68,6 @@ async fn main() -> anyhow::Result<()> {
pool,
meili_url: config.meili_url.clone(),
meili_master_key: config.meili_master_key.clone(),
thumbnail_config: config.thumbnail_config.clone(),
api_base_url: config.api_base_url.clone(),
api_bootstrap_token: config.api_bootstrap_token.clone(),
};