mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:...
This commit is contained in:
parent
606f3a6dd1
commit
18d9e00938
@ -92,7 +92,6 @@ class PageProcessor(list):
|
||||
|
||||
|
||||
def __call__(self):
|
||||
try:
|
||||
img = NewMagickWand()
|
||||
if img < 0:
|
||||
raise RuntimeError('Cannot create wand.')
|
||||
@ -109,7 +108,8 @@ class PageProcessor(list):
|
||||
DestroyMagickWand(thumb)
|
||||
|
||||
self.pages = [img]
|
||||
|
||||
if self.num == 2:
|
||||
raise Exception('asd')
|
||||
if width > height:
|
||||
if self.opts.landscape:
|
||||
self.rotate = True
|
||||
@ -122,11 +122,6 @@ class PageProcessor(list):
|
||||
MagickCropImage(split2, (width/2)-1, height, width/2, 0 )
|
||||
self.pages = [split2, split1] if self.opts.right2left else [split1, split2]
|
||||
self.process_pages()
|
||||
except Exception, err:
|
||||
print 'Failed to process page: %s'%os.path.basename(self.path_to_page)
|
||||
print 'Error:', err
|
||||
if self.opts.verbose:
|
||||
traceback.print_exc()
|
||||
|
||||
def process_pages(self):
|
||||
for i, wand in enumerate(self.pages):
|
||||
@ -195,16 +190,19 @@ def process_page(path, dest, opts, num):
|
||||
|
||||
class Progress(object):
|
||||
|
||||
def __init__(self, total, update):
|
||||
def __init__(self, total, update, verbose):
|
||||
self.total = total
|
||||
self.update = update
|
||||
self.done = 0
|
||||
self.verbose = verbose
|
||||
|
||||
def __call__(self, job):
|
||||
self.done += 1
|
||||
msg = _('Rendered %s') if job.result else _('Failed %s')
|
||||
msg = msg%os.path.basename(job.args[0])
|
||||
self.update(float(self.done)/self.total, msg)
|
||||
if not job.result and self.verbose:
|
||||
print job.traceback
|
||||
|
||||
def process_pages(pages, opts, update):
|
||||
'''
|
||||
@ -214,7 +212,7 @@ def process_pages(pages, opts, update):
|
||||
raise RuntimeError('Failed to load ImageMagick')
|
||||
|
||||
tdir = PersistentTemporaryDirectory('_comic2lrf_pp')
|
||||
notify = Progress(len(pages), update)
|
||||
notify = Progress(len(pages), update, opts.verbose)
|
||||
server = Server()
|
||||
jobs = []
|
||||
for i, path in enumerate(pages):
|
||||
|
Loading…
x
Reference in New Issue
Block a user