Skip to content

Commit

Permalink
Merge branch 'release/0.1.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
lb803 committed Feb 6, 2021
2 parents d2de365 + dd4b2ab commit 64616f4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def main(self):
return error_dialog(self.gui, 'No book open',
'Need to have a book open first', show=True)

if container.book_type != 'epub':
raise Exception('Access Aide supports EPUB files only, {} given.' \
.format(container.book_type))

# get book main language
try:
lang = container.opf_xpath('//dc:language/text()')[0]
Expand Down Expand Up @@ -185,7 +189,10 @@ def add_metadata(self, container):
# prevent overriding
if prefs['force_override'] \
or not container.opf_xpath(
'//*[contains(@property, "{}")]'.format(value)):
'''
//*[contains(@property, "{}")
and contains(text(), "{}")]
'''.format(value, text)):

element = lxml.etree.Element('meta')
element.set('property', ('schema:' + value))
Expand All @@ -201,7 +208,10 @@ def add_metadata(self, container):
# prevent overriding
if prefs['force_override'] \
or not container.opf_xpath(
'//*[contains(@name, "{}")]'.format(value)):
'''
//*[contains(@name, "{}")
and contains(@content, "{}")]
'''.format(value, text)):

element = lxml.etree.Element('meta')
element.set('name', ('schema:' + value))
Expand Down

0 comments on commit 64616f4

Please sign in to comment.