mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Fix for broken file type plugins
Prevent file type plugins that spin the event loop by displaying a dialog from causing locking errors. The lock is now acquired only after the file type plugin has run on import.
This commit is contained in:
parent
610f29d223
commit
ae439f110e
@ -1200,14 +1200,14 @@ class Cache(object):
|
||||
|
||||
@api
|
||||
def add_format(self, book_id, fmt, stream_or_path, replace=True, run_hooks=True, dbapi=None):
|
||||
with self.write_lock:
|
||||
if run_hooks:
|
||||
# Run import plugins
|
||||
npath = run_import_plugins(stream_or_path, fmt)
|
||||
fmt = os.path.splitext(npath)[-1].lower().replace('.', '').upper()
|
||||
stream_or_path = lopen(npath, 'rb')
|
||||
fmt = check_ebook_format(stream_or_path, fmt)
|
||||
if run_hooks:
|
||||
# Run import plugins
|
||||
npath = run_import_plugins(stream_or_path, fmt)
|
||||
fmt = os.path.splitext(npath)[-1].lower().replace('.', '').upper()
|
||||
stream_or_path = lopen(npath, 'rb')
|
||||
fmt = check_ebook_format(stream_or_path, fmt)
|
||||
|
||||
with self.write_lock:
|
||||
fmt = (fmt or '').upper()
|
||||
self.format_metadata_cache[book_id].pop(fmt, None)
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user