def __init__(self, name=None, pretty_name=None, id=None, img_id=None, ext='', pages=0, name_format='[%i][%a][%t]', **kwargs): self.name = name self.pretty_name = pretty_name self.id = id self.img_id = img_id self.ext = ext self.pages = pages self.downloader = None self.url = '%s/%d' % (DETAIL_URL, self.id) self.info = DoujinshiInfo(**kwargs) name_format = name_format.replace('%i', str(self.id)) name_format = name_format.replace('%a', self.info.artists) name_format = name_format.replace('%t', self.name) name_format = name_format.replace('%p', self.pretty_name) name_format = name_format.replace('%s', self.info.subtitle) self.filename = format_filename(name_format) self.table = [ ["Parodies", self.info.parodies], ["Doujinshi", self.name], ["Subtitle", self.info.subtitle], ["Characters", self.info.characters], ["Authors", self.info.artists], ["Languages", self.info.languages], ["Tags", self.info.tags], ["URL", self.url], ["Pages", self.pages], ]
def download(self): logger.info('Start 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, format_filename('%s-%s' % (self.id, self.name[:200]))) else: logger.critical('Downloader has not be loaded')
def __init__(self, name=None, id=None, img_id=None, ext='', pages=0, **kwargs): self.name = name self.id = id self.img_id = img_id self.ext = ext self.pages = pages self.downloader = None self.url = '%s/%d' % (DETAIL_URL, self.id) self.info = DoujinshiInfo(**kwargs) self.filename = format_filename('[%s][%s][%s]' % (self.id, self.info.artist, self.name))
def __init__(self, name=None, id=None, img_id=None, ext='', pages=0, name_format='[%i][%a][%t]', **kwargs): self.name = name self.id = id self.img_id = img_id self.ext = ext self.pages = pages self.downloader = None self.url = '%s/%d' % (DETAIL_URL, self.id) self.info = DoujinshiInfo(**kwargs) name_format = name_format.replace('%i', str(self.id)) 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 = format_filename(name_format)