From 84ea9825259ada9f9426bc7c4648ce2ea6008ba2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 20 Feb 2017 08:50:34 +0530 Subject: [PATCH] Allow sending KFX files to connected kindle devices. Fixes #1666040 [Enhancement: Add an option to send .kfx to kindle](https://bugs.launchpad.net/calibre/+bug/1666040) --- src/calibre/devices/kindle/driver.py | 6 +++--- src/calibre/devices/mtp/defaults.py | 4 +--- src/calibre/ebooks/__init__.py | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/calibre/devices/kindle/driver.py b/src/calibre/devices/kindle/driver.py index 7f475d5b04..a84e160c67 100644 --- a/src/calibre/devices/kindle/driver.py +++ b/src/calibre/devices/kindle/driver.py @@ -335,7 +335,7 @@ class KINDLE2(KINDLE): name = 'Kindle 2/3/4/Touch/PaperWhite/Voyage Device Interface' description = _('Communicate with the Kindle 2/3/4/Touch/PaperWhite/Voyage eBook reader.') - FORMATS = ['azw', 'mobi', 'azw3', 'prc', 'azw1', 'tpz', 'azw4', 'pobi', 'pdf', 'txt'] + FORMATS = ['azw', 'mobi', 'azw3', 'prc', 'azw1', 'tpz', 'azw4', 'kfx', 'pobi', 'pdf', 'txt'] DELETE_EXTS = KINDLE.DELETE_EXTS + ['.mbp1', '.mbs', '.sdr', '.han'] # On the Touch, there's also .asc files, but not using the same basename # (for X-Ray & End Actions), azw3f & azw3r files, but all of them are in @@ -415,7 +415,7 @@ class KINDLE2(KINDLE): return vals def formats_to_scan_for(self): - ans = USBMS.formats_to_scan_for(self) | {'azw3'} + ans = USBMS.formats_to_scan_for(self) | {'azw3', 'kfx'} return ans def books(self, oncard=None, end_session=True): @@ -563,7 +563,7 @@ class KINDLE_FIRE(KINDLE2): name = 'Kindle Fire Device Interface' description = _('Communicate with the Kindle Fire') gui_name = 'Fire' - FORMATS = ['azw3', 'azw', 'mobi', 'prc', 'azw1', 'tpz', 'azw4', 'pobi', 'pdf', 'txt'] + FORMATS = ['azw3', 'azw', 'mobi', 'prc', 'azw1', 'tpz', 'azw4', 'kfx', 'pobi', 'pdf', 'txt'] PRODUCT_ID = [0x0006] BCD = [0x216, 0x100] diff --git a/src/calibre/devices/mtp/defaults.py b/src/calibre/devices/mtp/defaults.py index e01c4be8a4..dff78e9e7e 100644 --- a/src/calibre/devices/mtp/defaults.py +++ b/src/calibre/devices/mtp/defaults.py @@ -19,7 +19,7 @@ class DeviceDefaults(object): # Amazon devices ({'vendor':0x1949}, { 'format_map': ['azw3', 'mobi', 'azw', - 'azw1', 'azw4', 'pdf'], + 'azw1', 'azw4', 'kfx', 'pdf'], 'send_to': ['documents', 'books', 'kindle'], } ), @@ -61,5 +61,3 @@ class DeviceDefaults(object): return ans return {} - - diff --git a/src/calibre/ebooks/__init__.py b/src/calibre/ebooks/__init__.py index 785d964ed9..699be348b0 100644 --- a/src/calibre/ebooks/__init__.py +++ b/src/calibre/ebooks/__init__.py @@ -35,7 +35,7 @@ BOOK_EXTENSIONS = ['lrf', 'rar', 'zip', 'rtf', 'lit', 'txt', 'txtz', 'text', 'ht 'epub', 'fb2', 'djv', 'djvu', 'lrx', 'cbr', 'cbz', 'cbc', 'oebzip', 'rb', 'imp', 'odt', 'chm', 'tpz', 'azw1', 'pml', 'pmlz', 'mbp', 'tan', 'snb', 'xps', 'oxps', 'azw4', 'book', 'zbf', 'pobi', 'docx', 'docm', 'md', - 'textile', 'markdown', 'ibook', 'ibooks', 'iba', 'azw3', 'ps', 'kepub'] + 'textile', 'markdown', 'ibook', 'ibooks', 'iba', 'azw3', 'ps', 'kepub', 'kfx'] class HTMLRenderer(object):