pinakes-core: improve media management features; various configuration improvements

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I2d1f04f13970d21c36067f30bc04a9176a6a6964
This commit is contained in:
raf 2026-02-05 00:54:10 +03:00
commit e02c15490e
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
31 changed files with 1167 additions and 197 deletions

View file

@ -2,7 +2,7 @@ use pinakes_core::books::{extract_isbn_from_text, normalize_isbn, parse_author_f
use pinakes_core::enrichment::books::BookEnricher;
use pinakes_core::enrichment::googlebooks::GoogleBooksClient;
use pinakes_core::enrichment::openlibrary::OpenLibraryClient;
use pinakes_core::thumbnail::{extract_epub_cover, generate_book_covers, CoverSize};
use pinakes_core::thumbnail::{CoverSize, extract_epub_cover, generate_book_covers};
#[test]
fn test_isbn_normalization() {
@ -136,9 +136,13 @@ fn test_book_cover_generation() {
let mut img_data = Vec::new();
{
use image::{ImageBuffer, Rgb};
let img: ImageBuffer<Rgb<u8>, Vec<u8>> = ImageBuffer::from_fn(100, 100, |_, _| Rgb([255u8, 0u8, 0u8]));
img.write_to(&mut std::io::Cursor::new(&mut img_data), image::ImageFormat::Png)
.unwrap();
let img: ImageBuffer<Rgb<u8>, Vec<u8>> =
ImageBuffer::from_fn(100, 100, |_, _| Rgb([255u8, 0u8, 0u8]));
img.write_to(
&mut std::io::Cursor::new(&mut img_data),
image::ImageFormat::Png,
)
.unwrap();
}
let temp_dir = tempdir().unwrap();

View file

@ -36,6 +36,13 @@ async fn test_media_crud() {
thumbnail_path: None,
custom_fields: HashMap::new(),
file_mtime: None,
date_taken: None,
latitude: None,
longitude: None,
camera_make: None,
camera_model: None,
rating: None,
perceptual_hash: None,
created_at: now,
updated_at: now,
};
@ -115,6 +122,13 @@ async fn test_tags() {
thumbnail_path: None,
custom_fields: HashMap::new(),
file_mtime: None,
date_taken: None,
latitude: None,
longitude: None,
camera_make: None,
camera_model: None,
rating: None,
perceptual_hash: None,
created_at: now,
updated_at: now,
};
@ -168,6 +182,13 @@ async fn test_collections() {
thumbnail_path: None,
custom_fields: HashMap::new(),
file_mtime: None,
date_taken: None,
latitude: None,
longitude: None,
camera_make: None,
camera_model: None,
rating: None,
perceptual_hash: None,
created_at: now,
updated_at: now,
};
@ -216,6 +237,13 @@ async fn test_custom_fields() {
thumbnail_path: None,
custom_fields: HashMap::new(),
file_mtime: None,
date_taken: None,
latitude: None,
longitude: None,
camera_make: None,
camera_model: None,
rating: None,
perceptual_hash: None,
created_at: now,
updated_at: now,
};
@ -283,6 +311,13 @@ async fn test_search() {
thumbnail_path: None,
custom_fields: HashMap::new(),
file_mtime: None,
date_taken: None,
latitude: None,
longitude: None,
camera_make: None,
camera_model: None,
rating: None,
perceptual_hash: None,
created_at: now,
updated_at: now,
};
@ -415,6 +450,13 @@ async fn test_library_statistics_with_data() {
thumbnail_path: None,
custom_fields: HashMap::new(),
file_mtime: None,
date_taken: None,
latitude: None,
longitude: None,
camera_make: None,
camera_model: None,
rating: None,
perceptual_hash: None,
created_at: now,
updated_at: now,
};
@ -452,6 +494,13 @@ fn make_test_media(hash: &str) -> MediaItem {
thumbnail_path: None,
custom_fields: HashMap::new(),
file_mtime: None,
date_taken: None,
latitude: None,
longitude: None,
camera_make: None,
camera_model: None,
rating: None,
perceptual_hash: None,
created_at: now,
updated_at: now,
}

View file

@ -39,6 +39,13 @@ fn create_test_media_item(path: PathBuf, hash: &str) -> MediaItem {
thumbnail_path: None,
custom_fields: HashMap::new(),
file_mtime: None,
date_taken: None,
latitude: None,
longitude: None,
camera_make: None,
camera_model: None,
rating: None,
perceptual_hash: None,
created_at: chrono::Utc::now(),
updated_at: chrono::Utc::now(),
}