fix(api): use CBX Extractor in the CBX processor (#409)

* fix(api): use CBX Extractor in the CBX processor

instead of implementing a separate cover detection algorithm in CBX
processor, this uses the CBXMetadataExtractor to fetch the cover image.
this means we now will take into account expected file names,
`ComicInfo.xml` definitions, and fall back to correctly sorted files

* style(api): drop unused imports

* fix(api): drop placeholder for cbx

this brings the CBX metadata extractor in line
with the other metadata extractors that return
null when no cover can be found

* fix: handle no cover
This commit is contained in:
James Ward
2026-04-22 17:27:05 -04:00
committed by Zach Yale
parent d502c18948
commit 5318e10677
3 changed files with 14 additions and 67 deletions
@@ -920,19 +920,14 @@ class CbxMetadataExtractorTest {
}
@Test
void returnPlaceholderForEmptyCbz() throws IOException {
void returnNullForEmptyCbz() throws IOException {
Path cbzPath = mockArchiveContents(Map.of(
"readme.txt", "no images here".getBytes()
));
byte[] cover = extractor.extractCover(cbzPath);
assertThat(cover).isNotNull();
// Placeholder is a generated image
BufferedImage img = ImageIO.read(new ByteArrayInputStream(cover));
assertThat(img).isNotNull();
assertThat(img.getWidth()).isEqualTo(250);
assertThat(img.getHeight()).isEqualTo(350);
assertThat(cover).isNull();
}
@Test
@@ -1040,7 +1035,7 @@ class CbxMetadataExtractorTest {
byte[] cover = extractor.extractCover(path);
assertThat(cover).isNotNull();
assertThat(cover).isNull();
}
}
@@ -1197,7 +1192,7 @@ class CbxMetadataExtractorTest {
byte[] cover = extractor.extractCover(path);
assertThat(cover).isNotNull();
assertThat(cover).isNull();
}
}
}