mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
ba693e77a4
commit
8e67557674
@ -6,7 +6,7 @@ from calibre.ebooks.BeautifulSoup import BeautifulSoup, BeautifulStoneSoup, Tag,
|
|||||||
from calibre.customize import CatalogPlugin
|
from calibre.customize import CatalogPlugin
|
||||||
from calibre.ptempfile import PersistentTemporaryDirectory
|
from calibre.ptempfile import PersistentTemporaryDirectory
|
||||||
from calibre.customize.conversion import OptionRecommendation, DummyReporter
|
from calibre.customize.conversion import OptionRecommendation, DummyReporter
|
||||||
|
from calibre import filesystem_encoding
|
||||||
|
|
||||||
FIELDS = ['all', 'author_sort', 'authors', 'comments',
|
FIELDS = ['all', 'author_sort', 'authors', 'comments',
|
||||||
'cover', 'formats', 'id', 'isbn', 'pubdate', 'publisher', 'rating',
|
'cover', 'formats', 'id', 'isbn', 'pubdate', 'publisher', 'rating',
|
||||||
@ -377,7 +377,10 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
self.text = ''.join(result)
|
self.text = ''.join(result)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
number = int(self.number)
|
number = int(self.number)
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
if number > 1000000:
|
if number > 1000000:
|
||||||
self.text = "%d out of range" % number
|
self.text = "%d out of range" % number
|
||||||
@ -2453,12 +2456,14 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
|
|
||||||
def generateThumbnail(self, title, image_dir, thumb_file):
|
def generateThumbnail(self, title, image_dir, thumb_file):
|
||||||
import calibre.utils.PythonMagickWand as pw
|
import calibre.utils.PythonMagickWand as pw
|
||||||
|
with pw.ImageMagick():
|
||||||
try:
|
try:
|
||||||
img = pw.NewMagickWand()
|
img = pw.NewMagickWand()
|
||||||
if img < 0:
|
if img < 0:
|
||||||
raise RuntimeError('generate_thumbnail(): Cannot create wand')
|
raise RuntimeError('generate_thumbnail(): Cannot create wand')
|
||||||
# Read the cover
|
# 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']
|
print 'Failed to read cover image from: %s' % title['cover']
|
||||||
raise IOError
|
raise IOError
|
||||||
thumb = pw.CloneMagickWand(img)
|
thumb = pw.CloneMagickWand(img)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user