mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-20 02:41:19 +02:00
fix #369
This commit is contained in:
parent
d74fd103f0
commit
54af682848
@ -152,6 +152,7 @@ class Downloader(Singleton):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
digit_length = len(str(len(queue)))
|
digit_length = len(str(len(queue)))
|
||||||
|
logger.info(f'Total download pages: {len(queue)}')
|
||||||
coroutines = [
|
coroutines = [
|
||||||
self._semaphore_download(url, filename=os.path.basename(urlparse(url).path), length=digit_length)
|
self._semaphore_download(url, filename=os.path.basename(urlparse(url).path), length=digit_length)
|
||||||
for url in queue
|
for url in queue
|
||||||
|
@ -18,6 +18,7 @@ from nhentai.logger import logger
|
|||||||
from nhentai.serializer import serialize_json, serialize_comic_xml, set_js_database
|
from nhentai.serializer import serialize_json, serialize_comic_xml, set_js_database
|
||||||
|
|
||||||
MAX_FIELD_LENGTH = 100
|
MAX_FIELD_LENGTH = 100
|
||||||
|
EXTENSIONS = ('.png', '.jpg', '.jpeg', '.gif', '.webp')
|
||||||
|
|
||||||
|
|
||||||
def request(method, url, **kwargs):
|
def request(method, url, **kwargs):
|
||||||
@ -130,7 +131,7 @@ def generate_html(output_dir='.', doujinshi_obj=None, template='default'):
|
|||||||
file_list.sort()
|
file_list.sort()
|
||||||
|
|
||||||
for image in file_list:
|
for image in file_list:
|
||||||
if not os.path.splitext(image)[1] in ('.jpg', '.png', '.webp'):
|
if not os.path.splitext(image)[1] in EXTENSIONS:
|
||||||
continue
|
continue
|
||||||
image_html += f'<img src="{image}" class="image-item"/>\n'
|
image_html += f'<img src="{image}" class="image-item"/>\n'
|
||||||
|
|
||||||
@ -256,7 +257,7 @@ def generate_doc(file_type='', output_dir='.', doujinshi_obj=None, regenerate=Fa
|
|||||||
import img2pdf
|
import img2pdf
|
||||||
|
|
||||||
"""Write images to a PDF file using img2pdf."""
|
"""Write images to a PDF file using img2pdf."""
|
||||||
file_list = [f for f in os.listdir(doujinshi_dir) if f.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.webp'))]
|
file_list = [f for f in os.listdir(doujinshi_dir) if f.lower().endswith(EXTENSIONS)]
|
||||||
file_list.sort()
|
file_list.sort()
|
||||||
|
|
||||||
logger.info(f'Writing PDF file to path: {filename}')
|
logger.info(f'Writing PDF file to path: {filename}')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user