Account for null cover images for book addition

More redo todo
This commit is contained in:
BasioMeusPuga
2017-11-15 12:56:37 +05:30
parent 945c5c0b49
commit dc9e2720f2
5 changed files with 10 additions and 26 deletions

View File

@@ -14,7 +14,7 @@
✓ Image reflow
✓ Search bar in toolbar
✓ Shift focus to the tab that has the book open
Tie file deletion and tab closing to model updates
Tie file deletion and tab closing to model updates
? Create emblem per filetype
Look into how you might group icons
Ignore a / the / numbers for sorting purposes
@@ -33,8 +33,8 @@
✓ Theming
✓ Keep fontsize and margins consistent - Let page increase in length
✓ Fullscreening
✓ Remember open tabs
Record progress
All ebooks should first be added to the database and then returned as HTML
Pagination
Set context menu for definitions and the like
Filetypes:
@@ -50,7 +50,7 @@
Get ISBN using python-isbnlib
Other:
✓ Define every widget in code
? Include icons for emblems
Include icons for emblems
"""
import sys

View File

@@ -19,12 +19,6 @@ class DatabaseInit:
"CREATE TABLE books \
(id INTEGER PRIMARY KEY, Title TEXT, Author TEXT, Year INTEGER, \
Path TEXT, Position BLOB, ISBN TEXT, Tags TEXT, Hash TEXT, CoverImage BLOB)")
self.database.execute(
"CREATE TABLE cache \
(id INTEGER PRIMARY KEY, Name TEXT, Path TEXT, CachedDict BLOB)")
# It's assumed that any cached books will be pickled and put into the
# database at time of closing
self.database.commit()
self.database.close()
@@ -53,14 +47,14 @@ class DatabaseFunctions:
sql_command_add = (
"INSERT INTO books (Title,Author,Year,Path,ISBN,Hash,CoverImage) VALUES(?, ?, ?, ?, ?, ?, ?)")
# TODO
# This is a placeholder. You will need to generate book covers
# in case none are found
cover_insert = None
if cover:
self.database.execute(
sql_command_add,
[title, author, year,
path, isbn, book_hash, sqlite3.Binary(cover)])
cover_insert = sqlite3.Binary(cover)
self.database.execute(
sql_command_add,
[title, author, year,
path, isbn, book_hash, cover_insert])
self.database.commit()
self.close_database()

View File

@@ -8,8 +8,6 @@ import collections
class ParseCBZ:
def __init__(self, filename, temp_dir, file_md5):
# TODO
# Maybe also include book description
self.filename = filename
self.book = None
self.temp_dir = temp_dir

View File

@@ -48,11 +48,6 @@ class ParseEPUB:
return None
def get_cover_image(self):
# TODO
# Generate a cover image in case one isn't found
# This has to be done or the database module will
# error out
# Get cover image
# This seems hack-ish, but that's never stopped me before
image_path = None

View File

@@ -87,9 +87,6 @@ class Settings:
self.settings.setValue('currentProfileIndex', current_profile_index)
self.settings.endGroup()
# TODO
# Last open order
# Last open highlighted
current_tab_index = self.parent_window.tabWidget.currentIndex()
if current_tab_index == 0:
last_open_tab = 'library'