ignore none as epub metadata value
This commit is contained in:
parent
d30ff2b4de
commit
fba2fa78ce
2 changed files with 1 additions and 2 deletions
|
@ -41,7 +41,6 @@ def metadata(f, from_=None):
|
||||||
metadata_opf = os.path.join(os.path.dirname(from_ or f), 'metadata.opf')
|
metadata_opf = os.path.join(os.path.dirname(from_ or f), 'metadata.opf')
|
||||||
if os.path.exists(metadata_opf):
|
if os.path.exists(metadata_opf):
|
||||||
opf_info = opf.info(metadata_opf)
|
opf_info = opf.info(metadata_opf)
|
||||||
|
|
||||||
for key in (
|
for key in (
|
||||||
'title', 'author', 'date', 'publisher', 'description',
|
'title', 'author', 'date', 'publisher', 'description',
|
||||||
'language', 'textsize', 'pages',
|
'language', 'textsize', 'pages',
|
||||||
|
|
|
@ -75,7 +75,7 @@ def info(epub):
|
||||||
info = ET.fromstring(z.read(opf[0]))
|
info = ET.fromstring(z.read(opf[0]))
|
||||||
metadata = info.findall('{http://www.idpf.org/2007/opf}metadata')[0]
|
metadata = info.findall('{http://www.idpf.org/2007/opf}metadata')[0]
|
||||||
for e in metadata.getchildren():
|
for e in metadata.getchildren():
|
||||||
if e.text:
|
if e.text and e.text not in ('unknown', 'none'):
|
||||||
key = e.tag.split('}')[-1]
|
key = e.tag.split('}')[-1]
|
||||||
key = {
|
key = {
|
||||||
'creator': 'author',
|
'creator': 'author',
|
||||||
|
|
Loading…
Reference in a new issue