From 533536ec4367253df92d12b0ad218c1d53d72a3e Mon Sep 17 00:00:00 2001 From: ^_^ <8480595+ballaballaballa@users.noreply.github.com> Date: Mon, 22 Dec 2025 20:50:21 +0100 Subject: [PATCH] fix: detect PDF-in-epub by content instead of API format type --- grawlix/__main__.py | 4 ++-- grawlix/sources/nextory.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/grawlix/__main__.py b/grawlix/__main__.py index 6370d4e..89bcbf6 100644 --- a/grawlix/__main__.py +++ b/grawlix/__main__.py @@ -163,8 +163,8 @@ async def download_with_progress(book: Book, progress: Progress, template: str, # Download the book await download_book(book, update_function, template) - # Convert PDF-in-epub to PDF if needed - if book.source_data and book.source_data.get('format_type') == 'pdf': + # Convert PDF-in-epub to PDF if needed (Nextory wraps PDFs in epub containers) + if book.source_data and book.source_data.get('source_name') == 'nextory': from .output import format_output_location, get_default_format from .pdf_converter import convert_pdf_epub_to_pdf, is_pdf_in_epub diff --git a/grawlix/sources/nextory.py b/grawlix/sources/nextory.py index 4fe89f9..04fa309 100644 --- a/grawlix/sources/nextory.py +++ b/grawlix/sources/nextory.py @@ -113,7 +113,7 @@ class Nextory(Source): async def _download_book(self, book_id: str) -> Book: product_data = await self._get_product_data(book_id) - format_type, format_id = self._find_format(product_data) + _, format_id = self._find_format(product_data) # Nextory serves all books via epub endpoint regardless of original format data = await self._get_epub_data(format_id) @@ -126,7 +126,6 @@ class Nextory(Source): ), source_data = { "source_name": "nextory", - "format_type": format_type, "details": product_data } )