2 from constant import DETAIL_URL, IMAGE_URL
3 from hentai.logger import logger
6 class Dojinshi(object):
7 def __init__(self, name=None, subtitle=None, id=None, img_id=None, ext='jpg', pages=0):
9 self.subtitle = subtitle
14 self.downloader = None
15 self.url = '%s/%d' % (DETAIL_URL, self.id)
18 return '<Dojinshi: %s>' % self.name
21 logger.info('Print dojinshi information')
22 print 'Dojinshi: %s' % self.name
23 print 'Subtitle: %s' % self.subtitle
24 print 'URL: %s' % self.url
25 print 'Pages: %d' % self.pages
28 logger.info('Start download dojinshi: %s' % self.name)
30 download_queue = Queue.Queue()
31 for i in xrange(1, self.pages + 1):
32 download_queue.put('%s/%d/%d.%s' % (IMAGE_URL, int(self.img_id), i, self.ext))
33 self.downloader.download(download_queue, self.id)
35 raise Exception('Downloader has not be loaded')
38 if __name__ == '__main__':
39 test = Dojinshi(name='test hentai dojinshi', id=1)
45 print 'Exception: %s' % str(e)