Skip to content
This repository has been archived by the owner on Mar 15, 2020. It is now read-only.

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rupor-github committed Jun 3, 2017
1 parent 78a24d1 commit 7e4b285
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions modules/fb2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,6 @@ def parse_binary(self, elem):
have_file = False
id = elem.attrib['id']
decl_type = elem.attrib['content-type'].lower()
filename = None
real_type = None
full_name = None
buff = base64.b64decode(elem.text.encode('ascii'))
try:
img = Image.open(io.BytesIO(buff))
Expand All @@ -567,7 +564,7 @@ def parse_binary(self, elem):
return

if real_type != decl_type:
self.log.warning('Declared and detected image types for ref id "{0}" do not match: "{1}" is not "{2}". Using detected type...'.format(id, decl_type, real_type))
self.log.warning('Declared and detected image types for ref-id "{0}" do not match: "{1}" is not "{2}". Using detected type...'.format(id, decl_type, real_type))

if self.removepngtransparency and format == 'png' and (img.mode in ('RGBA', 'LA') or (img.mode in ('RGB', 'L', 'P') and 'transparency' in img.info)):
try:
Expand Down Expand Up @@ -596,8 +593,8 @@ def parse_binary(self, elem):
full_name = os.path.join(os.path.join(self.temp_content_dir, 'images'), filename)
self.image_count += 1
else:
self.log.warning('Error while processing binary for ref-id "{0}". Skipping'.format(id))
self.log.debug('Getting details:', exc_info=True)
self.log.warning('Error while processing binary for ref-id "{0}". Skipping...'.format(id))
# self.log.debug('Getting details:', exc_info=True)
return

if not have_file:
Expand Down Expand Up @@ -1228,7 +1225,7 @@ def generate_cover(self):
filename = file
break
if not filename:
self.log.warning('Unable to find book cover image for ref-id "{0}. Something is very wrong..."'.format(self.book_cover))
self.log.warning('Unable to find book cover image for ref-id "{0}". Something is very wrong...'.format(self.book_cover))
self.book_cover = ''
return

Expand Down

0 comments on commit 7e4b285

Please sign in to comment.