mirror of
https://github.com/flibusta-apps/books_downloader.git
synced 2025-12-06 06:55:37 +01:00
Fix filename generation
This commit is contained in:
@@ -49,7 +49,7 @@ class BookLibraryClient:
|
||||
|
||||
@classmethod
|
||||
async def _make_request(cls, url) -> dict:
|
||||
async with httpx.AsyncClient() as client:
|
||||
async with httpx.AsyncClient(timeout=60) as client:
|
||||
response = await client.get(url, headers=cls.auth_headers)
|
||||
return response.json()
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class FLDownloader(BaseDownloader):
|
||||
if self.book is None:
|
||||
raise ValueError("Book is None!")
|
||||
|
||||
return get_filename(self.book, self.file_type)
|
||||
return get_filename(self.book_id, self.book, self.file_type)
|
||||
|
||||
async def get_final_filename(self) -> str:
|
||||
if self.need_zip:
|
||||
|
||||
@@ -54,7 +54,7 @@ def get_short_name(author: BookAuthor) -> str:
|
||||
return " ".join(name_parts)
|
||||
|
||||
|
||||
def get_filename(book: Book, file_type: str) -> str:
|
||||
def get_filename(book_id: int, book: Book, file_type: str) -> str:
|
||||
filename_parts = []
|
||||
|
||||
if book.authors:
|
||||
@@ -86,6 +86,6 @@ def get_filename(book: Book, file_type: str) -> str:
|
||||
):
|
||||
filename = filename.replace(c, r)
|
||||
|
||||
right_part = f".{book.id}.{file_type}"
|
||||
right_part = f".{book_id}.{file_type}"
|
||||
|
||||
return filename[: 64 - len(right_part)] + right_part
|
||||
|
||||
Reference in New Issue
Block a user