mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Cleanup previous PR
This commit is contained in:
parent
74d685ffa4
commit
0ce8e9af3c
@ -10,7 +10,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
import io
|
||||
import os
|
||||
import posixpath
|
||||
from contextlib import closing
|
||||
from contextlib import closing, suppress
|
||||
|
||||
from calibre import CurrentDir
|
||||
from calibre.ebooks.metadata.opf import get_metadata as get_metadata_from_opf
|
||||
@ -22,6 +22,7 @@ from calibre.utils.localunzip import LocalZipFile
|
||||
from calibre.utils.xml_parse import safe_xml_fromstring
|
||||
from calibre.utils.zipfile import BadZipfile, ZipFile, safe_replace
|
||||
|
||||
|
||||
class EPubException(Exception):
|
||||
pass
|
||||
|
||||
@ -133,7 +134,7 @@ class OCFReader(OCF):
|
||||
|
||||
def exists(self, path):
|
||||
try:
|
||||
self.open(path)
|
||||
self.open(path).close()
|
||||
return True
|
||||
except OSError:
|
||||
return False
|
||||
@ -214,6 +215,7 @@ def render_cover(cpage, zf, reader=None):
|
||||
if not os.path.exists(cpage):
|
||||
return
|
||||
|
||||
with suppress(Exception):
|
||||
# In the case of manga, the first spine item may be an image
|
||||
# already, so treat it as a raster cover.
|
||||
file_format = what_image_type(cpage)
|
||||
|
Loading…
x
Reference in New Issue
Block a user