Account for null cover images for book addition
More redo todo
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
✓ Image reflow
|
✓ Image reflow
|
||||||
✓ Search bar in toolbar
|
✓ Search bar in toolbar
|
||||||
✓ Shift focus to the tab that has the book open
|
✓ 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
|
? Create emblem per filetype
|
||||||
Look into how you might group icons
|
Look into how you might group icons
|
||||||
Ignore a / the / numbers for sorting purposes
|
Ignore a / the / numbers for sorting purposes
|
||||||
@@ -33,8 +33,8 @@
|
|||||||
✓ Theming
|
✓ Theming
|
||||||
✓ Keep fontsize and margins consistent - Let page increase in length
|
✓ Keep fontsize and margins consistent - Let page increase in length
|
||||||
✓ Fullscreening
|
✓ Fullscreening
|
||||||
|
✓ Remember open tabs
|
||||||
Record progress
|
Record progress
|
||||||
All ebooks should first be added to the database and then returned as HTML
|
|
||||||
Pagination
|
Pagination
|
||||||
Set context menu for definitions and the like
|
Set context menu for definitions and the like
|
||||||
Filetypes:
|
Filetypes:
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
Get ISBN using python-isbnlib
|
Get ISBN using python-isbnlib
|
||||||
Other:
|
Other:
|
||||||
✓ Define every widget in code
|
✓ Define every widget in code
|
||||||
? Include icons for emblems
|
✓ Include icons for emblems
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
14
database.py
14
database.py
@@ -19,12 +19,6 @@ class DatabaseInit:
|
|||||||
"CREATE TABLE books \
|
"CREATE TABLE books \
|
||||||
(id INTEGER PRIMARY KEY, Title TEXT, Author TEXT, Year INTEGER, \
|
(id INTEGER PRIMARY KEY, Title TEXT, Author TEXT, Year INTEGER, \
|
||||||
Path TEXT, Position BLOB, ISBN TEXT, Tags TEXT, Hash TEXT, CoverImage BLOB)")
|
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.commit()
|
||||||
self.database.close()
|
self.database.close()
|
||||||
|
|
||||||
@@ -53,14 +47,14 @@ class DatabaseFunctions:
|
|||||||
sql_command_add = (
|
sql_command_add = (
|
||||||
"INSERT INTO books (Title,Author,Year,Path,ISBN,Hash,CoverImage) VALUES(?, ?, ?, ?, ?, ?, ?)")
|
"INSERT INTO books (Title,Author,Year,Path,ISBN,Hash,CoverImage) VALUES(?, ?, ?, ?, ?, ?, ?)")
|
||||||
|
|
||||||
# TODO
|
cover_insert = None
|
||||||
# This is a placeholder. You will need to generate book covers
|
|
||||||
# in case none are found
|
|
||||||
if cover:
|
if cover:
|
||||||
|
cover_insert = sqlite3.Binary(cover)
|
||||||
|
|
||||||
self.database.execute(
|
self.database.execute(
|
||||||
sql_command_add,
|
sql_command_add,
|
||||||
[title, author, year,
|
[title, author, year,
|
||||||
path, isbn, book_hash, sqlite3.Binary(cover)])
|
path, isbn, book_hash, cover_insert])
|
||||||
|
|
||||||
self.database.commit()
|
self.database.commit()
|
||||||
self.close_database()
|
self.close_database()
|
||||||
|
@@ -8,8 +8,6 @@ import collections
|
|||||||
|
|
||||||
class ParseCBZ:
|
class ParseCBZ:
|
||||||
def __init__(self, filename, temp_dir, file_md5):
|
def __init__(self, filename, temp_dir, file_md5):
|
||||||
# TODO
|
|
||||||
# Maybe also include book description
|
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.book = None
|
self.book = None
|
||||||
self.temp_dir = temp_dir
|
self.temp_dir = temp_dir
|
||||||
|
@@ -48,11 +48,6 @@ class ParseEPUB:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def get_cover_image(self):
|
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
|
# Get cover image
|
||||||
# This seems hack-ish, but that's never stopped me before
|
# This seems hack-ish, but that's never stopped me before
|
||||||
image_path = None
|
image_path = None
|
||||||
|
@@ -87,9 +87,6 @@ class Settings:
|
|||||||
self.settings.setValue('currentProfileIndex', current_profile_index)
|
self.settings.setValue('currentProfileIndex', current_profile_index)
|
||||||
self.settings.endGroup()
|
self.settings.endGroup()
|
||||||
|
|
||||||
# TODO
|
|
||||||
# Last open order
|
|
||||||
# Last open highlighted
|
|
||||||
current_tab_index = self.parent_window.tabWidget.currentIndex()
|
current_tab_index = self.parent_window.tabWidget.currentIndex()
|
||||||
if current_tab_index == 0:
|
if current_tab_index == 0:
|
||||||
last_open_tab = 'library'
|
last_open_tab = 'library'
|
||||||
|
Reference in New Issue
Block a user