Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Book didnt get coverted after updating Calibre and KFX #679

Open
nicholelee opened this issue Nov 25, 2024 · 3 comments
Open

Book didnt get coverted after updating Calibre and KFX #679

nicholelee opened this issue Nov 25, 2024 · 3 comments

Comments

@nicholelee
Copy link

Question / bug report

Previously, I was able to just drag KFX file into Calibre and it converted to KFX file then EPUB.

Just updated Calibre and KFX Input, and now file became KFX-zip (which means it didnt convert successfully).

Not sure why? :(

Which version of Calibre are you running?

7.21

Which version of the DeDRM plugin are you running?

10.0.9

If applicable, which version of the Kindle software are you running?

No response

Log output

ApplicationPaletteChange event ignored
Using calibre Qt style: True
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
2024-11-25 17:10:16.328 calibre-debug[8731:579186] TSMSendMessageToUIServer: CFMessagePortSendRequest FAILED(-1) to send to port com.apple.tsm.uiserver
calibre Debug log
calibre 7.21  embedded-python: True
macOS-14.6.1-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '23.6.0', 'Darwin Kernel Version 23.6.0: Mon Jul 29 21:16:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8112')
Python 3.11.5
OSX: ('14.6.1', ('', '', ''), 'arm64')
Interface language: None
EXE path: /Applications/calibre.app/Contents/MacOS/calibre-debug
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 17, 0) && DeDRM (10, 0, 9) && Package KFX (from KFX Input) (2, 17, 0) && KFX metadata reader (from KFX Input) (2, 17, 0) && From KFX (2, 17, 0) && KFX Input (2, 17, 0) && Set KFX metadata (from KFX Output) (2, 12, 0) && KFX Output (2, 12, 0)
calibre 7.21  embedded-python: True
macOS-14.6.1-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '23.6.0', 'Darwin Kernel Version 23.6.0: Mon Jul 29 21:16:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8112')
Python 3.11.5
OSX: ('14.6.1', ('', '', ''), 'arm64')
Interface language: None
EXE path: /Applications/calibre.app/Contents/MacOS/calibre-debug
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 17, 0) && DeDRM (10, 0, 9) && Package KFX (from KFX Input) (2, 17, 0) && KFX metadata reader (from KFX Input) (2, 17, 0) && From KFX (2, 17, 0) && KFX Input (2, 17, 0) && Set KFX metadata (from KFX Output) (2, 12, 0) && KFX Output (2, 12, 0)
QPA platform: cocoa
devicePixelRatio: 2.0
logicalDpi: 72.0 x 72.0
physicalDpi: 128.5000019298764 x 128.5000019298764
[0.00] Starting up...
[0.01] Showing splash screen...
[1.20] splash screen shown
[1.20] Initializing db...
[1.21] db initialized
[1.21] Constructing main UI...
[2.01] GUI main window shown
[2.04] main UI initialized...
[2.04] Hiding splash screen
[2.04] splash screen hidden
[2.04] Started up in 2.04 seconds with 8 books
Gather KFX-ZIP (from KFX Input) 2.17.0: Importing /Users/nicol/Library/Containers/com.amazon.Lassen/Data/Library/eBooks/B0DG48ZBZ5/E1FC2445-3683-4904-A838-04DD070EA428/BookManifest.kfx
Gather KFX-ZIP (from KFX Input): Gathered 5 file(s) as /var/folders/4b/_n6zxxxd0xl3nklwl8gqd1l00000gn/C/calibre_7.21.0_tmp_39srkhis/94t5jgk4.kfx-zip
DeDRM v10.0.9: Trying to decrypt 94t5jgk4.kfx-zip
Decrypting KFX-ZIP ebook: 94t5jgk4
Got DSN key from database default_key_1732571316
Found 1 keys to try after 0.5 seconds
Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.fa89fc9f-c8c1-402b-b416-6fc0013b44af.voucher
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Traceback (most recent call last):
  File "/Users/nicol/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher
    voucher.decryptvoucher()
  File "/Users/nicol/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 1368, in decryptvoucher
    raise ex
          ^^
UnboundLocalError: cannot access local variable 'ex' where it is not associated with a value
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Traceback (most recent call last):
  File "/Users/nicol/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher
    voucher.decryptvoucher()
  File "/Users/nicol/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 1368, in decryptvoucher
    raise ex
          ^^
UnboundLocalError: cannot access local variable 'ex' where it is not associated with a value
DeDRM v10.0.9: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key
DeDRM v10.0.9: Looking for new default Kindle Key after 0.5 seconds
Found k4Mac kinf2018 file: /Users/nicol/Library/Application Support/Kindle/storage/.kinf2018
trying username  b'nicol'  on file  /Users/nicol/Library/Application Support/Kindle/storage/.kinf2018
trying IDString: b'b3608aafaf6b'
trying IDString: b'b3608aafaf6a'
trying IDString: b'9362a58682e5'
trying IDString: b'b9f279a0d3dc'
Decrypted key file using IDString 'b9f279a0d3dc' and UserName 'nicol'
DeDRM v10.0.9: Ultimately failed to decrypt after 1.3 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
Running file type plugin DeDRM failed with traceback:
Traceback (most recent call last):
  File "calibre_plugins.dedrm.__init__", line 931, in KindleMobiDecrypt
    book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,androidFiles,serials,pids,self.starttime)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nicol/Library/Preferences/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 203, in GetDecryptedBook
    mb.processBook(totalpids)
  File "/Users/nicol/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 67, in processBook
    self.decrypt_voucher(totalpids)
  File "/Users/nicol/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 111, in decrypt_voucher
    raise Exception("Failed to decrypt KFX DRM voucher with any key")
Exception: Failed to decrypt KFX DRM voucher with any key

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "calibre/customize/ui.py", line 201, in _run_filetype_plugins
  File "calibre_plugins.dedrm.__init__", line 1030, in run
    decrypted_ebook = self.KindleMobiDecrypt(path_to_ebook)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.dedrm.__init__", line 981, in KindleMobiDecrypt
    raise DeDRMError("{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime))
calibre_plugins.dedrm.DeDRMError: DeDRM v10.0.9: Ultimately failed to decrypt after 1.3 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
Package KFX (from KFX Input) 2.17.0: Packaging /var/folders/4b/_n6zxxxd0xl3nklwl8gqd1l00000gn/C/calibre_7.21.0_tmp_39srkhis/94t5jgk4.kfx-zip
Processing container: CR!5GRFK7883155Q3KZBW1HAMKDT71X.azw9.res
Processing container: CR!RFA7T3499N2FSEBFCA48MN0KEV79.azw8
Running file type plugin Package KFX (from KFX Input) failed with traceback:
Traceback (most recent call last):
  File "calibre/customize/ui.py", line 201, in _run_filetype_plugins
  File "calibre_plugins.kfx_input.package_filetype", line 23, in run
    return self.package_kfx(path_to_ebook)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.kfx_input.package_filetype", line 34, in package_kfx
    kfx_data = YJ_Book(path_to_ebook).convert_to_single_kfx()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 79, in convert_to_single_kfx
    self.decode_book()
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 212, in decode_book
    container = self.get_container(datafile)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 321, in get_container
    raise KFXDRMError("Book container %s has DRM and cannot be converted" % datafile.name)
calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container CR!RFA7T3499N2FSEBFCA48MN0KEV79.azw8 has DRM and cannot be converted
KFX metadata reader (from KFX Input) activated for /var/folders/4b/_n6zxxxd0xl3nklwl8gqd1l00000gn/C/calibre_7.21.0_tmp_39srkhis/t1tqxk5i_add_books/0/BookManifest.kfx-zip
Traceback (most recent call last):
  File "calibre/customize/ui.py", line 483, in get_file_type_metadata
  File "calibre_plugins.kfx_input.metadata_reader", line 28, in get_metadata
    md = YJ_Book(stream).get_metadata()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 150, in get_metadata
    raise Exception("Failed to locate a KFX container with metadata")
Exception: Failed to locate a KFX container with metadata
Added BookManifest to db in: 0.0
Added 1 books in 8.2 seconds
@ElleKayEm
Copy link

Did you download it with Kindle for Mac 7.x? That only works on some books with less restrictive DRM. Often marked on their Amazon page details as "Simultaneous device usage: Unlimited". See this post for other methods: https://www.mobileread.com/forums/showthread.php?t=361503

@nicholelee
Copy link
Author

Yes but I also tried books that i have download from the same version, and some works and some were successfully converted to KFX.

It seems like it doesnt matter if it's "Simultaneous device usage: Unlimited" or not, some just works and some doesnt :/

@ElleKayEm
Copy link

At this time, you'll need to use another method for the ones that don't decrypt when downloaded with the current Mac app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants