mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix calibre holding file handles on the Cybook, preventing it from being ejected
This commit is contained in:
parent
5247233b4b
commit
8b18917435
@ -39,13 +39,13 @@ def metadata_from_formats(formats):
|
|||||||
return mi2
|
return mi2
|
||||||
|
|
||||||
for path, ext in zip(formats, extensions):
|
for path, ext in zip(formats, extensions):
|
||||||
stream = open(path, 'rb')
|
with open(path, 'rb') as stream:
|
||||||
try:
|
try:
|
||||||
mi.smart_update(get_metadata(stream, stream_type=ext, use_libprs_metadata=True))
|
mi.smart_update(get_metadata(stream, stream_type=ext, use_libprs_metadata=True))
|
||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
if getattr(mi, 'application_id', None) is not None:
|
if getattr(mi, 'application_id', None) is not None:
|
||||||
return mi
|
return mi
|
||||||
|
|
||||||
if not mi.title:
|
if not mi.title:
|
||||||
mi.title = _('Unknown')
|
mi.title = _('Unknown')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user