From 0c8264bcc64dc66d5cb42367feda880b185da91b Mon Sep 17 00:00:00 2001 From: RicterZ Date: Tue, 15 Jan 2019 20:43:00 +0800 Subject: [PATCH] fix download issues --- nhentai/doujinshi.py | 10 +++++++++- nhentai/utils.py | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/nhentai/doujinshi.py b/nhentai/doujinshi.py index d38e16b..0dc6faf 100644 --- a/nhentai/doujinshi.py +++ b/nhentai/doujinshi.py @@ -58,9 +58,17 @@ class Doujinshi(object): logger.info('Starting to download doujinshi: %s' % self.name) if self.downloader: download_queue = [] + + for i in range(1, self.pages + 1): + download_queue.append('%s/%d/%d.%s' % (IMAGE_URL, int(self.img_id), i, self.ext)) + + self.downloader.download(download_queue, self.filename) + + ''' for i in range(len(self.ext)): download_queue.append('%s/%d/%d.%s' % (IMAGE_URL, int(self.img_id), i+1, EXT_MAP[self.ext[i]])) - self.downloader.download(download_queue, self.filename) + ''' + else: logger.critical('Downloader has not been loaded') diff --git a/nhentai/utils.py b/nhentai/utils.py index 7ffe332..f884d2f 100644 --- a/nhentai/utils.py +++ b/nhentai/utils.py @@ -121,4 +121,7 @@ an invalid filename. filename = filename.replace(' ', '_') # I don't like spaces in filenames. if len(filename) > 100: filename = filename[:100] + '...]' + + # Remove [] from filename + filename = filename.replace('[]', '') return filename