mirror of
https://github.com/flibusta-apps/books_downloader.git
synced 2025-12-06 06:55:37 +01:00
Fix filename getting
This commit is contained in:
@@ -57,6 +57,8 @@ def get_short_name(author: BookAuthor) -> str:
|
|||||||
def get_filename(book_id: int, book: Book, file_type: str) -> str:
|
def get_filename(book_id: int, book: Book, file_type: str) -> str:
|
||||||
filename_parts = []
|
filename_parts = []
|
||||||
|
|
||||||
|
file_type_ = "fb2.zip" if file_type == "fb2zip" else file_type
|
||||||
|
|
||||||
if book.authors:
|
if book.authors:
|
||||||
filename_parts.append(
|
filename_parts.append(
|
||||||
"_".join([get_short_name(a) for a in book.authors]) + "_-_"
|
"_".join([get_short_name(a) for a in book.authors]) + "_-_"
|
||||||
@@ -86,6 +88,6 @@ def get_filename(book_id: int, book: Book, file_type: str) -> str:
|
|||||||
):
|
):
|
||||||
filename = filename.replace(c, r)
|
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
|
return filename[: 64 - len(right_part)] + right_part
|
||||||
|
|||||||
Reference in New Issue
Block a user