Small fixes

This commit is contained in:
BasioMeusPuga
2019-02-02 00:53:09 +05:30
parent dfe0fceea9
commit d1662b47d9
4 changed files with 16 additions and 10 deletions

View File

@@ -92,16 +92,18 @@ class FB2:
self.book['cover'] = None
def parse_chapters(self, temp_dir):
# There's no need to parse the TOC separately because
# everything is linear
for i in self.xml.find_all('section'):
this_title = '<No title>'
for j in i:
if j.name == 'title':
this_title = j.getText(separator=' ')
this_title = this_title.replace('\n', '').strip()
# This comes later because the tag is changed in place
title_xml = j.unwrap()
break
self.book['book_list'].append(
[this_title, str(i)])
[this_title, str(title_xml) + str(i)])
# Extract all images to the temp_dir
for i in self.xml.find_all('binary'):