|
|
@ -43,13 +43,16 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
|
|
|
|
|
|
|
|
|
|
|
|
epub_metadata = {}
|
|
|
|
epub_metadata = {}
|
|
|
|
|
|
|
|
|
|
|
|
for s in ['title', 'description', 'creator', 'language']:
|
|
|
|
for s in ['title', 'description', 'creator', 'language', 'subject']:
|
|
|
|
tmp = p.xpath('dc:%s/text()' % s, namespaces=ns)
|
|
|
|
tmp = p.xpath('dc:%s/text()' % s, namespaces=ns)
|
|
|
|
if len(tmp) > 0:
|
|
|
|
if len(tmp) > 0:
|
|
|
|
epub_metadata[s] = p.xpath('dc:%s/text()' % s, namespaces=ns)[0]
|
|
|
|
epub_metadata[s] = p.xpath('dc:%s/text()' % s, namespaces=ns)[0]
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
epub_metadata[s] = "Unknown"
|
|
|
|
epub_metadata[s] = "Unknown"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if epub_metadata['subject'] == "Unknown":
|
|
|
|
|
|
|
|
epub_metadata['subject'] = ''
|
|
|
|
|
|
|
|
|
|
|
|
if epub_metadata['description'] == "Unknown":
|
|
|
|
if epub_metadata['description'] == "Unknown":
|
|
|
|
description = tree.xpath("//*[local-name() = 'description']/text()")
|
|
|
|
description = tree.xpath("//*[local-name() = 'description']/text()")
|
|
|
|
if len(description) > 0:
|
|
|
|
if len(description) > 0:
|
|
|
@ -101,7 +104,7 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
|
|
|
|
author=epub_metadata['creator'].encode('utf-8').decode('utf-8'),
|
|
|
|
author=epub_metadata['creator'].encode('utf-8').decode('utf-8'),
|
|
|
|
cover=coverfile,
|
|
|
|
cover=coverfile,
|
|
|
|
description=epub_metadata['description'],
|
|
|
|
description=epub_metadata['description'],
|
|
|
|
tags="",
|
|
|
|
tags=epub_metadata['subject'].encode('utf-8').decode('utf-8'),
|
|
|
|
series="",
|
|
|
|
series="",
|
|
|
|
series_id="",
|
|
|
|
series_id="",
|
|
|
|
languages=epub_metadata['language'])
|
|
|
|
languages=epub_metadata['language'])
|
|
|
|