Extract and set the series name and index for EPUBs

This commit is contained in:
adityachandelgit
2025-04-09 18:04:57 -06:00
committed by Aditya Chandel
parent 5e2305b492
commit 87f40733d7
@@ -137,6 +137,21 @@ public class EpubProcessor implements FileProcessor {
}); });
} }
String seriesName = epubMetadata.getMetaAttribute("calibre:series");
if (seriesName != null && !seriesName.isEmpty()) {
bookMetadata.setSeriesName(seriesName);
}
String seriesIndex = epubMetadata.getMetaAttribute("calibre:series_index");
if (seriesIndex != null && !seriesIndex.isEmpty()) {
try {
double indexValue = Double.parseDouble(seriesIndex);
bookMetadata.setSeriesNumber((int) indexValue);
} catch (NumberFormatException e) {
log.warn("Unable to parse series number: {}", seriesIndex);
}
}
bookCreatorService.addAuthorsToBook(getAuthors(book), bookEntity); bookCreatorService.addAuthorsToBook(getAuthors(book), bookEntity);
bookCreatorService.addCategoriesToBook(epubMetadata.getSubjects(), bookEntity); bookCreatorService.addCategoriesToBook(epubMetadata.getSubjects(), bookEntity);
} }