mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Kobo driver: Allow sending kepubs to older kobo devices as well
Refactor the code to allow sending kepubs to the older devices as well. Fixes #1257972 [Move sending kepubs from KOBOTOUCH to KOBO driver](https://bugs.launchpad.net/calibre/+bug/1257972)
This commit is contained in:
parent
dfe41f7136
commit
50b621397e
@ -77,7 +77,7 @@ class KOBO(USBMS):
|
||||
book_class = Book
|
||||
|
||||
# Ordered list of supported formats
|
||||
FORMATS = ['epub', 'pdf', 'txt', 'cbz', 'cbr']
|
||||
FORMATS = ['kepub', 'epub', 'pdf', 'txt', 'cbz', 'cbr']
|
||||
CAN_SET_METADATA = ['collections']
|
||||
|
||||
VENDOR_ID = [0x2237]
|
||||
@ -384,6 +384,17 @@ class KOBO(USBMS):
|
||||
self.report_progress(1.0, _('Getting list of books on device...'))
|
||||
return bl
|
||||
|
||||
def filename_callback(self, path, mi):
|
||||
# debug_print("Kobo:filename_callback:Path - {0}".format(path))
|
||||
|
||||
idx = path.rfind('.')
|
||||
ext = path[idx:]
|
||||
if ext == KEPUB_EXT:
|
||||
path = path + EPUB_EXT
|
||||
# debug_print("Kobo:filename_callback:New path - {0}".format(path))
|
||||
|
||||
return path
|
||||
|
||||
def delete_via_sql(self, ContentID, ContentType):
|
||||
# Delete Order:
|
||||
# 1) shortcover_page
|
||||
@ -1260,7 +1271,6 @@ class KOBOTOUCH(KOBO):
|
||||
min_fwversion_images_tree = (2, 9, 0) # Cover images stored in tree under .kobo-images
|
||||
|
||||
has_kepubs = True
|
||||
FORMATS = ['kepub', 'epub', 'cbr', 'cbz', 'pdf', 'txt']
|
||||
|
||||
booklist_class = KTCollectionsBookList
|
||||
book_class = Book
|
||||
@ -1985,17 +1995,6 @@ class KOBOTOUCH(KOBO):
|
||||
|
||||
return True
|
||||
|
||||
def filename_callback(self, path, mi):
|
||||
# debug_print("KoboTouch:filename_callback:Path - {0}".format(path))
|
||||
|
||||
idx = path.rfind('.')
|
||||
ext = path[idx:]
|
||||
if ext == KEPUB_EXT:
|
||||
path = path + EPUB_EXT
|
||||
# debug_print("KoboTouch:filename_callback:New path - {0}".format(path))
|
||||
|
||||
return path
|
||||
|
||||
def delete_via_sql(self, ContentID, ContentType):
|
||||
imageId = super(KOBOTOUCH, self).delete_via_sql(ContentID, ContentType)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user