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):
|
def __call__(self):
|
||||||
try:
|
|
||||||
img = NewMagickWand()
|
img = NewMagickWand()
|
||||||
if img < 0:
|
if img < 0:
|
||||||
raise RuntimeError('Cannot create wand.')
|
raise RuntimeError('Cannot create wand.')
|
||||||
@ -109,7 +108,8 @@ class PageProcessor(list):
|
|||||||
DestroyMagickWand(thumb)
|
DestroyMagickWand(thumb)
|
||||||
|
|
||||||
self.pages = [img]
|
self.pages = [img]
|
||||||
|
if self.num == 2:
|
||||||
|
raise Exception('asd')
|
||||||
if width > height:
|
if width > height:
|
||||||
if self.opts.landscape:
|
if self.opts.landscape:
|
||||||
self.rotate = True
|
self.rotate = True
|
||||||
@ -122,11 +122,6 @@ class PageProcessor(list):
|
|||||||
MagickCropImage(split2, (width/2)-1, height, width/2, 0 )
|
MagickCropImage(split2, (width/2)-1, height, width/2, 0 )
|
||||||
self.pages = [split2, split1] if self.opts.right2left else [split1, split2]
|
self.pages = [split2, split1] if self.opts.right2left else [split1, split2]
|
||||||
self.process_pages()
|
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):
|
def process_pages(self):
|
||||||
for i, wand in enumerate(self.pages):
|
for i, wand in enumerate(self.pages):
|
||||||
@ -195,16 +190,19 @@ def process_page(path, dest, opts, num):
|
|||||||
|
|
||||||
class Progress(object):
|
class Progress(object):
|
||||||
|
|
||||||
def __init__(self, total, update):
|
def __init__(self, total, update, verbose):
|
||||||
self.total = total
|
self.total = total
|
||||||
self.update = update
|
self.update = update
|
||||||
self.done = 0
|
self.done = 0
|
||||||
|
self.verbose = verbose
|
||||||
|
|
||||||
def __call__(self, job):
|
def __call__(self, job):
|
||||||
self.done += 1
|
self.done += 1
|
||||||
msg = _('Rendered %s') if job.result else _('Failed %s')
|
msg = _('Rendered %s') if job.result else _('Failed %s')
|
||||||
msg = msg%os.path.basename(job.args[0])
|
msg = msg%os.path.basename(job.args[0])
|
||||||
self.update(float(self.done)/self.total, msg)
|
self.update(float(self.done)/self.total, msg)
|
||||||
|
if not job.result and self.verbose:
|
||||||
|
print job.traceback
|
||||||
|
|
||||||
def process_pages(pages, opts, update):
|
def process_pages(pages, opts, update):
|
||||||
'''
|
'''
|
||||||
@ -214,7 +212,7 @@ def process_pages(pages, opts, update):
|
|||||||
raise RuntimeError('Failed to load ImageMagick')
|
raise RuntimeError('Failed to load ImageMagick')
|
||||||
|
|
||||||
tdir = PersistentTemporaryDirectory('_comic2lrf_pp')
|
tdir = PersistentTemporaryDirectory('_comic2lrf_pp')
|
||||||
notify = Progress(len(pages), update)
|
notify = Progress(len(pages), update, opts.verbose)
|
||||||
server = Server()
|
server = Server()
|
||||||
jobs = []
|
jobs = []
|
||||||
for i, path in enumerate(pages):
|
for i, path in enumerate(pages):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user