mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix memory leak in catalog generation
This commit is contained in:
commit
ac3041d044
@ -255,12 +255,14 @@ class CatalogPlugin(Plugin):
|
|||||||
|
|
||||||
def search_sort_db(self, db, opts):
|
def search_sort_db(self, db, opts):
|
||||||
|
|
||||||
|
'''
|
||||||
# Don't add Catalogs to the generated Catalogs
|
# Don't add Catalogs to the generated Catalogs
|
||||||
cat = _('Catalog')
|
cat = _('Catalog')
|
||||||
if opts.search_text:
|
if opts.search_text:
|
||||||
opts.search_text += ' not tag:'+cat
|
opts.search_text += ' not tag:'+cat
|
||||||
else:
|
else:
|
||||||
opts.search_text = 'not tag:'+cat
|
opts.search_text = 'not tag:'+cat
|
||||||
|
'''
|
||||||
|
|
||||||
db.search(opts.search_text)
|
db.search(opts.search_text)
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class PluginWidget(QWidget,Ui_Form):
|
|||||||
TITLE = _('E-book Options')
|
TITLE = _('E-book Options')
|
||||||
HELP = _('Options specific to')+' EPUB/MOBI '+_('output')
|
HELP = _('Options specific to')+' EPUB/MOBI '+_('output')
|
||||||
OPTION_FIELDS = [('exclude_genre','\[[\w ]*\]'),
|
OPTION_FIELDS = [('exclude_genre','\[[\w ]*\]'),
|
||||||
('exclude_tags','~'),
|
('exclude_tags','~,'+_('Catalog')),
|
||||||
('read_tag','+'),
|
('read_tag','+'),
|
||||||
('note_tag','*')]
|
('note_tag','*')]
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
help=_("Regex describing tags to exclude as genres.\n" "Default: '%default' excludes bracketed tags, e.g. '[<tag>]'\n"
|
help=_("Regex describing tags to exclude as genres.\n" "Default: '%default' excludes bracketed tags, e.g. '[<tag>]'\n"
|
||||||
"Applies to: ePub, MOBI output formats")),
|
"Applies to: ePub, MOBI output formats")),
|
||||||
Option('--exclude-tags',
|
Option('--exclude-tags',
|
||||||
default='~',
|
default=('~,'+_('Catalog')),
|
||||||
dest='exclude_tags',
|
dest='exclude_tags',
|
||||||
help=_("Comma-separated list of tag words indicating book should be excluded from output. Case-insensitive.\n"
|
help=_("Comma-separated list of tag words indicating book should be excluded from output. Case-insensitive.\n"
|
||||||
"--exclude-tags=skip will match 'skip this book' and 'Skip will like this'.\n"
|
"--exclude-tags=skip will match 'skip this book' and 'Skip will like this'.\n"
|
||||||
@ -758,7 +758,10 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
if self.opts.ids:
|
if self.opts.ids:
|
||||||
self.opts.search_text = search_phrase
|
self.opts.search_text = search_phrase
|
||||||
else:
|
else:
|
||||||
self.opts.search_text = self.opts.search_text + " " + search_phrase
|
if self.opts.search_text:
|
||||||
|
self.opts.search_text += " " + search_phrase
|
||||||
|
else:
|
||||||
|
self.opts.search_text = search_phrase
|
||||||
|
|
||||||
# Fetch the database as a dictionary
|
# Fetch the database as a dictionary
|
||||||
data = self.plugin.search_sort_db(self.db, self.opts)
|
data = self.plugin.search_sort_db(self.db, self.opts)
|
||||||
@ -2495,6 +2498,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
pw.MagickThumbnailImage(thumb, 75, 100)
|
pw.MagickThumbnailImage(thumb, 75, 100)
|
||||||
pw.MagickWriteImage(thumb, os.path.join(image_dir, thumb_file))
|
pw.MagickWriteImage(thumb, os.path.join(image_dir, thumb_file))
|
||||||
pw.DestroyMagickWand(thumb)
|
pw.DestroyMagickWand(thumb)
|
||||||
|
pw.DestroyMagickWand(img)
|
||||||
except IOError:
|
except IOError:
|
||||||
print "generate_thumbnail() IOError with %s" % title['title']
|
print "generate_thumbnail() IOError with %s" % title['title']
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user