This commit is contained in:
Kovid Goyal 2010-01-22 13:29:44 -07:00
parent ba693e77a4
commit 8e67557674

View File

@ -6,7 +6,7 @@ from calibre.ebooks.BeautifulSoup import BeautifulSoup, BeautifulStoneSoup, Tag,
from calibre.customize import CatalogPlugin
from calibre.ptempfile import PersistentTemporaryDirectory
from calibre.customize.conversion import OptionRecommendation, DummyReporter
from calibre import filesystem_encoding
FIELDS = ['all', 'author_sort', 'authors', 'comments',
'cover', 'formats', 'id', 'isbn', 'pubdate', 'publisher', 'rating',
@ -377,7 +377,10 @@ class EPUB_MOBI(CatalogPlugin):
self.text = ''.join(result)
else:
try:
number = int(self.number)
except:
return
if number > 1000000:
self.text = "%d out of range" % number
@ -2453,12 +2456,14 @@ class EPUB_MOBI(CatalogPlugin):
def generateThumbnail(self, title, image_dir, thumb_file):
import calibre.utils.PythonMagickWand as pw
with pw.ImageMagick():
try:
img = pw.NewMagickWand()
if img < 0:
raise RuntimeError('generate_thumbnail(): Cannot create wand')
# Read the cover
if not pw.MagickReadImage(img, title['cover']):
if not pw.MagickReadImage(img,
title['cover'].encode(filesystem_encoding)):
print 'Failed to read cover image from: %s' % title['cover']
raise IOError
thumb = pw.CloneMagickWand(img)