Account for no images in an epub
This commit is contained in:
5
TODO
5
TODO
@@ -24,6 +24,7 @@ TODO
|
|||||||
✓ Context menu: Cache, Read, Edit database, delete, Mark read/unread
|
✓ Context menu: Cache, Read, Edit database, delete, Mark read/unread
|
||||||
✓ Information dialog widget
|
✓ Information dialog widget
|
||||||
✓ Allow editing of database data through the UI + for Bookmarks
|
✓ Allow editing of database data through the UI + for Bookmarks
|
||||||
|
Include (action) icons with the applications
|
||||||
Set focus to newly added file
|
Set focus to newly added file
|
||||||
Reading:
|
Reading:
|
||||||
✓ Drop down for TOC
|
✓ Drop down for TOC
|
||||||
@@ -68,6 +69,7 @@ TODO
|
|||||||
Exiting with Ctrl + Q does not save the cursor position INITIALLY
|
Exiting with Ctrl + Q does not save the cursor position INITIALLY
|
||||||
|
|
||||||
Secondary:
|
Secondary:
|
||||||
|
pdf support
|
||||||
Annotations
|
Annotations
|
||||||
Graphical themes
|
Graphical themes
|
||||||
Change focus rectangle dimensions
|
Change focus rectangle dimensions
|
||||||
@@ -76,7 +78,7 @@ TODO
|
|||||||
Goodreads API: Ratings, Read, Recommendations
|
Goodreads API: Ratings, Read, Recommendations
|
||||||
Get ISBN using python-isbnlib
|
Get ISBN using python-isbnlib
|
||||||
Pagination
|
Pagination
|
||||||
Use embedded fonts
|
Use embedded fonts + CSS
|
||||||
Scrolling: Smooth / By Line
|
Scrolling: Smooth / By Line
|
||||||
Spacebar should not cut off lines at the top
|
Spacebar should not cut off lines at the top
|
||||||
Shift to logging instead of print statements
|
Shift to logging instead of print statements
|
||||||
@@ -91,5 +93,4 @@ TODO
|
|||||||
Ignore a / the / numbers for sorting purposes
|
Ignore a / the / numbers for sorting purposes
|
||||||
? Add only one file type if multiple are present
|
? Add only one file type if multiple are present
|
||||||
? Plugin system for parsers
|
? Plugin system for parsers
|
||||||
? pdf support
|
|
||||||
? Create emblem per filetype
|
? Create emblem per filetype
|
@@ -234,13 +234,6 @@ class EPUB:
|
|||||||
(fallback_title, chapter_data))
|
(fallback_title, chapter_data))
|
||||||
no_title_chapter += 1
|
no_title_chapter += 1
|
||||||
|
|
||||||
cover_path = os.path.join(temp_dir, os.path.basename(self.filename)) + '- cover'
|
|
||||||
with open(cover_path, 'wb') as cover_temp:
|
|
||||||
cover_temp.write(self.book['cover'])
|
|
||||||
|
|
||||||
self.book['book_list'][0] = (
|
|
||||||
'Cover', f'<center><img src="{cover_path}" alt="Cover"></center>')
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# https://stackoverflow.com/questions/14444732/how-to-split-a-html-page-to-multiple-pages-using-python-and-beautiful-soup
|
# https://stackoverflow.com/questions/14444732/how-to-split-a-html-page-to-multiple-pages-using-python-and-beautiful-soup
|
||||||
markup = BeautifulSoup(chapter_data, 'xml')
|
markup = BeautifulSoup(chapter_data, 'xml')
|
||||||
@@ -267,10 +260,10 @@ class EPUB:
|
|||||||
(fallback_title, this_chapter))
|
(fallback_title, this_chapter))
|
||||||
no_title_chapter += 1
|
no_title_chapter += 1
|
||||||
|
|
||||||
def main():
|
cover_path = os.path.join(temp_dir, os.path.basename(self.filename)) + '- cover'
|
||||||
book = EPUB(sys.argv[1])
|
if self.book['cover']:
|
||||||
book.read_epub()
|
with open(cover_path, 'wb') as cover_temp:
|
||||||
book.parse_chapters()
|
cover_temp.write(self.book['cover'])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
self.book['book_list'][0] = (
|
||||||
main()
|
'Cover', f'<center><img src="{cover_path}" alt="Cover"></center>')
|
||||||
|
Reference in New Issue
Block a user