From fbb7663a2fc6f7bbd847e1e9477a75e9760a251a Mon Sep 17 00:00:00 2001 From: Jan Guzej Date: Sat, 19 Oct 2019 14:04:15 -0400 Subject: [PATCH] epub metadata import fix --- cps/epub.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cps/epub.py b/cps/epub.py index d9129646..760df869 100644 --- a/cps/epub.py +++ b/cps/epub.py @@ -64,7 +64,12 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension): for s in ['title', 'description', 'creator', 'language', 'subject']: tmp = p.xpath('dc:%s/text()' % s, namespaces=ns) if len(tmp) > 0: - epub_metadata[s] = p.xpath('dc:%s/text()' % s, namespaces=ns)[0] + if s == 'creator': + epub_metadata[s] = ' & '.join(p.xpath('dc:%s/text()' % s, namespaces=ns)) + elif s == 'language' or s == 'subject': + epub_metadata[s] = ', '.join(p.xpath('dc:%s/text()' % s, namespaces=ns)) + else: + epub_metadata[s] = p.xpath('dc:%s/text()' % s, namespaces=ns)[0] else: epub_metadata[s] = "Unknown"