Quote:
Originally Posted by JSWolf
What ePub has another ePub? I've never see this. can you point out some eBooks that have this?
|
I can't give any specifics name. but I saw her. I don't know where it comes from, but, it's a real pain in the ass.
This kind of thing can make an ePub get really big.
original ePub < 500 kb
inner ePub > 4 MB
And in fact... I managed to modify my Quality Check to include the feature.
Code
config.py
Code:
('check_epub_inside_epub', {'name': 'Check ePub inside ePub', 'cat':'epub', 'sub_menu': 'Check ePub Structure', 'group': 3, 'excludable': True, 'image': 'images/check_book.png', 'tooltip':'Check for ePub formats containing a ePub inside'}),
check_epub.py
Code:
EPUB_FILES = ['.epub']
ALL_ARTIFACTS = ITUNES_FILES + BOOKMARKS_FILES + OS_FILES + EPUB_FILES
...
def perform_check(self, menu_key):
...
elif menu_key == 'check_epub_inside_epub':
self.check_epub_inside_epub()
...
...
def check_epub_inside_epub(self):
def evaluate_book(book_id, db):
path_to_book = db.format_abspath(book_id, 'EPUB', index_is_id=True)
if not path_to_book:
self.log.error('ERROR: EPUB format is missing: ', get_title_authors_text(db, book_id))
return False
try:
found = False
displayed_path = False
with ZipFile(path_to_book, 'r') as zf:
for resource_name in self._manifest_worthy_names(zf):
extension = resource_name[resource_name.rfind('.'):].lower()
if extension in EPUB_FILES:
if not displayed_path:
displayed_path = True
self.log('ePub found in: <b>%s</b>'%get_title_authors_text(db, book_id))
self.log('\t<span style="color:darkgray">%s</span>'%resource_name)
found = True
return found
except InvalidEpub as e:
self.log.error('Invalid epub:', e)
return False
except:
self.log.error('ERROR parsing book: ', path_to_book)
self.log(traceback.format_exc())
return False
self.check_all_files(evaluate_book,
no_match_msg='No searched ePub books have a ePub inside',
marked_text='epub_inside_epub',
status_msg_type='ePub books with a ePub inside')
A good listener, Chalut
EDIT: I realize that FONT_FILES does not include '.woff' and '.woff2'. It's true that the formats are recent and not supported on all reader, but they have become very common and I wouldn't be surprised to see them appear in a ePub.