fix download issues

This commit is contained in:
RicterZ 2019-01-15 20:43:00 +08:00
parent a6074242fb
commit 0c8264bcc6
2 changed files with 12 additions and 1 deletions

View File

@ -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')

View File

@ -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