1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-18 03:53:32 +02:00

Added first portion of logging adaptation.

Things may be broken at this point - there are still several modules to
be adapted.
This commit is contained in:
2021-06-22 22:04:43 +02:00
parent 6f898ab23e
commit 546cc26652
36 changed files with 326 additions and 316 deletions

View File

@@ -34,19 +34,19 @@ class RemoveFirstImage:
continue
removed = self.remove_images(item)
if removed > 0:
self.log('Removed first image')
self.log.info('Removed first image')
body = XPath('//h:body')(item.data)
if body:
raw = xml2text(body[0]).strip()
imgs = XPath('//h:img|//svg:svg')(item.data)
if not raw and not imgs:
self.log('Removing %s as it has no content' %
item.href)
self.log.info('Removing %s as it has no content',
item.href)
self.oeb.manifest.remove(item)
deleted_item = item
break
else:
self.log.warn('Could not find first image to remove')
self.log.warning('Could not find first image to remove')
if deleted_item is not None:
for item in list(self.oeb.toc):
href = urllib.parse.urldefrag(item.href)[0]