Update readme

Begin logging
Account for fb2 books without covers
This commit is contained in:
BasioMeusPuga
2019-01-19 01:19:58 +05:30
parent 5e3987dc04
commit 506c458544
25 changed files with 138 additions and 27 deletions

View File

@@ -17,9 +17,12 @@
import os
import base64
import zipfile
import logging
from bs4 import BeautifulSoup
logger = logging.getLogger(__name__)
class FB2:
def __init__(self, filename):
@@ -83,7 +86,9 @@ class FB2:
for i in cover_image_data:
if cover_image_name.endswith(i.get('id')):
self.book['cover'] = base64.decodebytes(i.text.encode())
except AttributeError:
except (AttributeError, TypeError):
# Catch TypeError in case no images exist in the book
logger.error('No cover found for: ' + self.filename)
self.book['cover'] = None
def parse_chapters(self, temp_dir):