# coding: utf-8
-from __future__ import print_function, unicode_literals
+
from tabulate import tabulate
-from future.builtins import range
from nhentai.constant import DETAIL_URL, IMAGE_URL
from nhentai.logger import logger
from nhentai.utils import format_filename
-
EXT_MAP = {
'j': 'jpg',
'p': 'png',
name_format = name_format.replace('%a', self.info.artists)
name_format = name_format.replace('%t', self.name)
name_format = name_format.replace('%s', self.info.subtitle)
- self.filename = name_format
-
- def __repr__(self):
- return '<Doujinshi: {0}>'.format(self.name)
+ self.filename = format_filename(name_format)
- def show(self):
- table = [
+ self.table = [
+ ["Parodies", self.info.parodies],
["Doujinshi", self.name],
["Subtitle", self.info.subtitle],
["Characters", self.info.characters],
["URL", self.url],
["Pages", self.pages],
]
- logger.info(u'Print doujinshi information of {0}\n{1}'.format(self.id, tabulate(table)))
+
+ def __repr__(self):
+ return '<Doujinshi: {0}>'.format(self.name)
+
+ def show(self):
+
+ logger.info(u'Print doujinshi information of {0}\n{1}'.format(self.id, tabulate(self.table)))
def download(self):
logger.info('Starting to download doujinshi: %s' % self.name)
logger.warning('Page count and ext count do not equal')
for i in range(1, min(self.pages, len(self.ext)) + 1):
- download_queue.append('%s/%d/%d.%s' % (IMAGE_URL, int(self.img_id), i, self.ext[i-1]))
+ download_queue.append('%s/%d/%d.%s' % (IMAGE_URL, int(self.img_id), i, self.ext[i - 1]))
self.downloader.download(download_queue, self.filename)