Update readme
Begin logging Account for fb2 books without covers
This commit is contained in:
@@ -15,11 +15,14 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import logging
|
||||
import zipfile
|
||||
from urllib.parse import unquote
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EPUB:
|
||||
def __init__(self, filename):
|
||||
@@ -189,7 +192,7 @@ class EPUB:
|
||||
if biggest_image:
|
||||
self.book['cover'] = self.read_from_zip(biggest_image)
|
||||
else:
|
||||
print('No cover found for: ' + self.filename)
|
||||
logger.error('No cover found for: ' + self.filename)
|
||||
|
||||
# Parse spine and arrange chapter paths acquired from the opf
|
||||
# according to the order IN THE SPINE
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user