Kobo driver can writes covers to wrong place for OSX when using SD card

- A user found that cover images were being sent to the main memory of the Kobo devices when the book was being sent to the SD card.  These covers should not have been sent to the device with FW2.4.0. With FW2.5.0, the covers should have been put onto the SD card.

- Fetch annotations was copying book from device to library
This commit is contained in:
davidfor 2013-04-29 14:17:45 +10:00
parent 71f61ac049
commit 6cbdac7c2f

View file

@ -35,7 +35,7 @@ class KOBO(USBMS):
gui_name = 'Kobo Reader'
description = _('Communicate with the Kobo Reader')
author = 'Timothy Legge and David Forrester'
version = (2, 0, 8)
version = (2, 0, 9)
dbversion = 0
fwversion = 0
@ -1193,8 +1193,11 @@ def add_annotation_to_library(self, db, db_id, annotation):
db.set_comment(db_id, mi.comments)
# Add bookmark file to db_id
db.add_format_with_hooks(db_id, bm.value.bookmark_extension,
bm.value.path, index_is_id=True)
# NOTE: As it is, this copied the book from the device back to the library. That meant it replaced the
# existing file. Taking this out for that reason, but some books have a ANNOT file that could be
# copied.
# db.add_format_with_hooks(db_id, bm.value.bookmark_extension,
# bm.value.path, index_is_id=True)
class KOBOTOUCH(KOBO):
@ -1366,7 +1369,7 @@ def books(self, oncard=None, end_session=True):
prefix = self._card_a_prefix if oncard == 'carda' else \
self._card_b_prefix if oncard == 'cardb' \
else self._main_prefix
debug_print("KoboTouch:books - prefix='%s'"%oncard)
debug_print("KoboTouch:books - oncard='%s', prefix='%s'"%(oncard, prefix))
# Determine the firmware version
try:
@ -2100,7 +2103,8 @@ def upload_cover(self, path, filename, metadata, filepath):
:param filepath: The full path to the ebook file
'''
# debug_print("KoboTouch:upload_cover - path='%s' filename='%s'"%(path, filename))
debug_print("KoboTouch:upload_cover - path='%s' filename='%s' "%(path, filename))
debug_print(" filepath='%s' "%(filepath))
opts = self.settings()
if not self.copying_covers():
@ -2109,7 +2113,7 @@ def upload_cover(self, path, filename, metadata, filepath):
return
# Only upload covers to SD card if that is supported
if self._card_a_prefix and path.startswith(self._card_a_prefix) and not self.supports_covers_on_sdcard():
if self._card_a_prefix and filepath.startswith(self._card_a_prefix) and not self.supports_covers_on_sdcard():
return
if not opts.extra_customization[self.OPT_UPLOAD_GRAYSCALE_COVERS]:
@ -2133,12 +2137,16 @@ def imageid_from_contentid(self, ContentID):
def images_path(self, path):
# In some cases, there is no trailing separator. Add it if there isn't as self._card_a_prefix does have it.
path = path if path[-1] == os.sep else path + os.sep
if self._card_a_prefix and path.startswith(self._card_a_prefix) and self.supports_covers_on_sdcard():
path_prefix = 'koboExtStorage/images/'
path = self._card_a_prefix + path_prefix
path = os.path.join(self._card_a_prefix, path_prefix)
else:
path_prefix = '.kobo/images/'
path = self._main_prefix + path_prefix
path = os.path.join(self._main_prefix, path_prefix)
return path
def _upload_cover(self, path, filename, metadata, filepath, uploadgrayscale, keep_cover_aspect=False):
@ -2181,7 +2189,7 @@ def _upload_cover(self, path, filename, metadata, filepath, uploadgrayscale, kee
cursor.close()
if ImageID != None:
path = self.images_path(path) + ImageID
path = os.path.join(self.images_path(path), ImageID)
if show_debug:
debug_print("KoboTouch:_upload_cover - About to loop over cover endings")