Remove the last sqlite3 reference and fix some cover issues

Had left an easy out to go back to sqlite3, but everything is working.

For the covers, shouldn't be sending one version with current firmware,
and fixed a check that was happening.
This commit is contained in:
David 2016-07-08 20:01:07 +10:00
parent a001db9ef1
commit f508fa69f3

View File

@ -31,8 +31,6 @@ from calibre.utils.config_base import prefs
EPUB_EXT = '.epub'
KEPUB_EXT = '.kepub'
USE_SQLITE3 = False
# Implementation of QtQHash for strings. This doesn't seem to be in the Python implementation.
def qhash(inputstr):
instr = b""
@ -159,15 +157,8 @@ class KOBO(USBMS):
return self.normalize_path(self._main_prefix + '.kobo/KoboReader.sqlite')
def device_database_connection(self):
if USE_SQLITE3:
import sqlite3 as sqlite
db_connection = sqlite.connect(self.device_database_path())
# return bytestrings if the content cannot the decoded as unicode
db_connection.text_factory = lambda x: unicode(x, "utf-8", "ignore")
else:
import apsw
db_connection = apsw.Connection(self.device_database_path())
import apsw
db_connection = apsw.Connection(self.device_database_path())
return db_connection
@ -1378,20 +1369,20 @@ class KOBOTOUCH(KOBO):
' - N3_LIBRARY_FULL.parsed':[(355,473),0, 200,False,], # Used for Details screen before FW2.8.1, then for current book tile on home screen
' - N3_LIBRARY_GRID.parsed':[(149,198),0, 200,False,], # Used for library lists
' - N3_LIBRARY_LIST.parsed':[(60,90),0, 53,False,],
' - AndroidBookLoadTablet_Aspect.parsed':[(355,473), 82, 200,False,], # Used for Details screen from FW2.8.1
' - AndroidBookLoadTablet_Aspect.parsed':[(355,473), 82, 100,False,], # Used for Details screen from FW2.8.1
# ' - N3_LIBRARY_SHELF.parsed': [(40,60),0, 52,],
}
GLO_COVER_FILE_ENDINGS = { # Glo and Aura share resolution, so the image sizes should be the same.
' - N3_FULL.parsed':[(758,1024),0, 200,True,], # Used for screensaver, home screen
' - N3_LIBRARY_FULL.parsed':[(355,479),0, 200,False,], # Used for Details screen before FW2.8.1, then for current book tile on home screen
' - N3_LIBRARY_GRID.parsed':[(149,201),0, 200,False,], # Used for library lists
' - AndroidBookLoadTablet_Aspect.parsed':[(355,479), 88, 200,False,], # Used for Details screen from FW2.8.1
' - AndroidBookLoadTablet_Aspect.parsed':[(355,479), 88, 100,False,], # Used for Details screen from FW2.8.1
}
AURA_HD_COVER_FILE_ENDINGS = {
' - N3_FULL.parsed': [(1080,1440), 0, 200,True,], # Used for screensaver, home screen
' - N3_LIBRARY_FULL.parsed':[(355, 471), 0, 200,False,], # Used for Details screen before FW2.8.1, then for current book tile on home screen
' - N3_LIBRARY_GRID.parsed':[(149, 198), 0, 200,False,], # Used for library lists
' - AndroidBookLoadTablet_Aspect.parsed':[(355, 471), 88, 200,False,], # Used for Details screen from FW2.8.1
' - AndroidBookLoadTablet_Aspect.parsed':[(355, 471), 88, 100,False,], # Used for Details screen from FW2.8.1
}
# Following are the sizes used with pre2.1.4 firmware
# COVER_FILE_ENDINGS = {
@ -1846,18 +1837,18 @@ class KOBOTOUCH(KOBO):
def imagefilename_from_imageID(self, prefix, ImageID):
show_debug = self.is_debugging_title(ImageID)
path = self.images_path(prefix, ImageID)
# path = self.normalize_path(path.replace('/', os.sep))
if len(ImageID) > 0:
path = self.images_path(prefix, ImageID)
for ending, cover_options in self.cover_file_endings().items():
fpath = path + ending
if os.path.exists(fpath):
if show_debug:
debug_print("KoboTouch:imagefilename_from_imageID - have cover image fpath=%s" % (fpath))
return fpath
for ending in self.cover_file_endings().keys():
fpath = path + ending
if os.path.exists(fpath):
if show_debug:
debug_print("KoboTouch:imagefilename_from_imageID - have cover image fpath=%s" % (fpath))
return fpath
if show_debug:
debug_print("KoboTouch:imagefilename_from_imageID - no cover image found - ImageID=%s" % (ImageID))
if show_debug:
debug_print("KoboTouch:imagefilename_from_imageID - no cover image found - ImageID=%s" % (ImageID))
return None
def get_extra_css(self):