|
|
@ -48,6 +48,7 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
epub_metadata[s] = "Unknown"
|
|
|
|
epub_metadata[s] = "Unknown"
|
|
|
|
#detect lang need futher modification in web.py /upload
|
|
|
|
#detect lang need futher modification in web.py /upload
|
|
|
|
|
|
|
|
try:#maybe dc:language isn't present, less possible but possible
|
|
|
|
lang = p.xpath('dc:language/text()', namespaces=ns)[0]
|
|
|
|
lang = p.xpath('dc:language/text()', namespaces=ns)[0]
|
|
|
|
lang = lang.split('-', 1)[0]
|
|
|
|
lang = lang.split('-', 1)[0]
|
|
|
|
if len(lang) == 2:
|
|
|
|
if len(lang) == 2:
|
|
|
@ -56,6 +57,8 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
|
|
|
|
epub_metadata['languages'] = isoLanguages.get(part3=lang).name
|
|
|
|
epub_metadata['languages'] = isoLanguages.get(part3=lang).name
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
epub_metadata['languages'] = ""
|
|
|
|
epub_metadata['languages'] = ""
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
epub_metadata['languages'] = ""
|
|
|
|
|
|
|
|
|
|
|
|
coversection = tree.xpath("/pkg:package/pkg:manifest/pkg:item[@id='cover-image']/@href", namespaces=ns)
|
|
|
|
coversection = tree.xpath("/pkg:package/pkg:manifest/pkg:item[@id='cover-image']/@href", namespaces=ns)
|
|
|
|
if len(coversection) > 0:
|
|
|
|
if len(coversection) > 0:
|
|
|
|