mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 21:50:28 +02:00
feat: Simplify EPUB chapter href normalization and enhance spine href logging
This commit is contained in:
@@ -362,7 +362,7 @@ def _extract_epub_chapters(epub_path: Path) -> List[Dict[str, str]]:
|
||||
nav_titles = _parse_ncx_document(nav_bytes, nav_base)
|
||||
|
||||
for index, href in enumerate(spine_hrefs, start=1):
|
||||
normalized = _normalize_epub_path("", href)
|
||||
normalized = href
|
||||
if not normalized:
|
||||
continue
|
||||
title = (
|
||||
@@ -375,7 +375,7 @@ def _extract_epub_chapters(epub_path: Path) -> List[Dict[str, str]]:
|
||||
|
||||
if not chapters and nav_titles:
|
||||
for index, (href, title) in enumerate(nav_titles.items(), start=1):
|
||||
normalized = _normalize_epub_path("", href)
|
||||
normalized = href
|
||||
if not normalized:
|
||||
continue
|
||||
label = title or posixpath.basename(normalized) or f"Chapter {index}"
|
||||
|
||||
@@ -1021,6 +1021,12 @@
|
||||
try {
|
||||
await book.ready;
|
||||
console.info('[reader] Book ready resolved');
|
||||
try {
|
||||
const spineEntries = (book.spine?.items || []).map((item) => item?.href || '(unknown)');
|
||||
console.info('[reader] Spine hrefs', spineEntries);
|
||||
} catch (spineError) {
|
||||
console.warn('[reader] Unable to log spine hrefs', spineError);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Book failed to initialize', error);
|
||||
if (error && error.message) {
|
||||
|
||||
Reference in New Issue
Block a user