mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:...
This commit is contained in:
parent
0c1f1c1c7b
commit
1c5ecad88f
@ -318,7 +318,7 @@ def extract(path, dir):
|
||||
raise Exception('Unknown archive type')
|
||||
extractor(path, dir)
|
||||
|
||||
def get_proxies(self):
|
||||
def get_proxies():
|
||||
proxies = {}
|
||||
if iswindows:
|
||||
try:
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import with_statement
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
@ -31,12 +31,13 @@ try:
|
||||
MagickQuantizeImage, RGBColorspace, \
|
||||
MagickWriteImage, DestroyPixelWand, \
|
||||
DestroyMagickWand, CloneMagickWand, \
|
||||
MagickThumbnailImage, MagickCropImage, initialize, finalize
|
||||
MagickThumbnailImage, MagickCropImage, ImageMagick
|
||||
_imagemagick_loaded = True
|
||||
except:
|
||||
_imagemagick_loaded = False
|
||||
|
||||
PROFILES = {
|
||||
# Name : (width, height) in pixels
|
||||
'prs500':(584, 754),
|
||||
}
|
||||
|
||||
@ -205,8 +206,7 @@ def process_pages(pages, opts, update):
|
||||
'''
|
||||
if not _imagemagick_loaded:
|
||||
raise RuntimeError('Failed to load ImageMagick')
|
||||
initialize()
|
||||
try:
|
||||
with ImageMagick():
|
||||
tdir = PersistentTemporaryDirectory('_comic2lrf_pp')
|
||||
processed_pages = [PageProcessor(path, tdir, opts, i) for i, path in enumerate(pages)]
|
||||
tp = ThreadPool(detect_ncpus())
|
||||
@ -223,9 +223,7 @@ def process_pages(pages, opts, update):
|
||||
else:
|
||||
ans += pp
|
||||
return ans, failures, tdir
|
||||
finally:
|
||||
finalize()
|
||||
|
||||
|
||||
def config(defaults=None):
|
||||
desc = _('Options to control the conversion of comics (CBR, CBZ) files into ebooks')
|
||||
if defaults is None:
|
||||
|
@ -104,6 +104,14 @@ def finalize():
|
||||
_magick.MagickWandTerminus()
|
||||
_initialized = False
|
||||
|
||||
class ImageMagick(object):
|
||||
|
||||
def __enter__(self):
|
||||
initialize()
|
||||
|
||||
def __exit__(self, *args):
|
||||
finalize()
|
||||
|
||||
|
||||
class MetricType(ctypes.c_int): pass
|
||||
UndefinedMetric = MetricType(0)
|
||||
|
@ -67,7 +67,7 @@ def run_recipe(opts, recipe_arg, parser, notification=None, handler=None):
|
||||
if notification is None:
|
||||
from calibre.utils.terminfo import TerminalController, ProgressBar
|
||||
term = TerminalController(sys.stdout)
|
||||
pb = ProgressBar(term, _('Fetching feeds...'), no_progress_bar=opts.progress_bar)
|
||||
pb = ProgressBar(term, _('Fetching feeds...'), no_progress_bar=not opts.progress_bar)
|
||||
notification = pb.update
|
||||
|
||||
recipe, is_profile = None, False
|
||||
|
Loading…
x
Reference in New Issue
Block a user