Skip to content
Snippets Groups Projects
Commit 1ed778e5 authored by Dmitry Shelepnev's avatar Dmitry Shelepnev
Browse files

Add extract cover from body image if coverpage empty

parent 5398b5bf
Branches
Tags
No related merge requests found
......@@ -59,6 +59,8 @@ class FB2Base(BookFile):
try:
tree = self.__create_tree__()
res = tree.xpath('/fb:FictionBook/fb:description/fb:title-info/fb:coverpage/fb:image', namespaces=self.__namespaces)
if len(res) == 0:
res = tree.xpath('/fb:FictionBook/fb:body/fb:image', namespaces=self.__namespaces)
cover_id = res[0].get('{' + Namespace.XLINK + '}href')[1:]
print(cover_id)
res = tree.xpath('/fb:FictionBook/fb:binary[@id="%s"]' % cover_id, namespaces=self.__namespaces)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment