Apple driver: Ignore invalid EPUBs when sending to iTunes

This commit is contained in:
Kovid Goyal 2011-03-05 14:54:19 -07:00
parent 41c25e037b
commit 64fd29fa3e

View File

@ -2512,7 +2512,12 @@ class ITUNES(DriverBase):
# Refresh epub metadata # Refresh epub metadata
with open(fpath,'r+b') as zfo: with open(fpath,'r+b') as zfo:
# Touch the OPF timestamp # Touch the OPF timestamp
zf_opf = ZipFile(fpath,'r') try:
zf_opf = ZipFile(fpath,'r')
except:
raise UserFeedback("'%s' is not a valid EPUB" % metadata.title,
None,
level=UserFeedback.WARN)
fnames = zf_opf.namelist() fnames = zf_opf.namelist()
opf = [x for x in fnames if '.opf' in x][0] opf = [x for x in fnames if '.opf' in x][0]
if opf: if opf: