noDRM / DeDRM_tools

DeDRM tools for ebooks
6.96k stars 306 forks source link

Failed kepub decryption for Obok for last book in Kobo e-reader library. #577

Open Trung0246 opened 1 month ago

Trung0246 commented 1 month ago

Question / bug report

Traceback (most recent call last):
    File "calibre\db\cache.py", line 1857, in set_metadata
    File "calibre\db\cache.py", line 1780, in set_cover
    File "calibre\db\backend.py", line 1791, in set_cover
    File "calibre\utils\img.py", line 302, in save_cover_data_to
    File "calibre\utils\img.py", line 205, in image_to_data
    ValueError: Failed to export image as JPEG with error: Image is empty

Book simply failed to decrypt. No idea why. The weird thing is this one is the only one in the series that encountered this issue. Others are just fine.

Book link (maybe region locked): https://www.kobo.com/us/en/ebook/juycyRzGHzGMKOeFxK8DFA

I'm willing to share the Kobo folder if that help.

Which version of Calibre are you running?

7.15

Which version of the DeDRM plugin are you running?

v10.0.3

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

No response

Log output

calibre 7.15  embedded-python: True
Windows-10-10.0.22621-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.22621')
Python 3.11.5
Windows: ('10', '10.0.22621', 'SP0', 'Multiprocessor Free')
Interface language: None
EXE path: C:\Program Files\Calibre2\calibre-debug.exe
Successfully initialized third party plugins: Obok DeDRM (10, 0, 3)
QPA platform: windows
devicePixelRatio: 1.5
logicalDpi: 96.0 x 96.0
physicalDpi: 63.98785625774473 x 64.00562060889929
ApplicationPaletteChange event ignored
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.19] splash screen shown
[0.19] Initializing db...
[0.19] db initialized
[0.19] Constructing main UI...
DEBUG:    0.0 obok::utilities.py - loading translations
DEBUG:    0.0 obok::dialogs.py - loading translations
DEBUG:    0.0 obok::config.py - loading translations
DEBUG:    0.0 obok::action_err.py - loading translations
[0.55] GUI main window shown
[0.89] main UI initialized...
[0.91] Hiding splash screen
[1.19] splash screen hidden
[1.19] Started up in 1.19 seconds with 5 books
Running Obok DeDRM v10.0.3
DEBUG:    9.6 didn't find device
Obok v10.0.1
Copyright © 2012-2022 Physisticated et al.
C:\Users\WDAGUT~1\AppData\Local\Temp\tmpcap0whvx
DEBUG:    9.7 got kobodir C:\Users\WDAGUtilityAccount\AppData\Local\Kobo\Kobo Desktop Edition
Found 8 possible keys to try.
DEBUG:   19.0 BookListTableWidget:get_books - book_num: 3
DEBUG:   19.0 BookListTableWidget:get_books - book: TITLE
DEBUG:   19.0 InterfacePluginAction::launchObok - number of books to decrypt: 1
Obok DeDRM v10.0.3 - Decrypting TITLE
Trying key:  b'redacted'
Success!
DEBUG:   21.6 DecryptAddProgressDialog::do_book_action - decrypted book: 'TITLE'
Traceback (most recent call last):
  File "calibre\db\cache.py", line 1857, in set_metadata
  File "calibre\db\cache.py", line 1780, in set_cover
  File "calibre\db\backend.py", line 1791, in set_cover
  File "calibre\utils\img.py", line 302, in save_cover_data_to
  File "calibre\utils\img.py", line 205, in image_to_data
ValueError: Failed to export image as JPEG with error: Image is empty
Obok DeDRM v10.0.3 - Added TITLE
Obok DeDRM v10.0.3 - wrapping up results.
Trung0246 commented 1 month ago

Potential duplicate since mine also have same issue as showing green lock: https://github.com/noDRM/DeDRM_tools/issues/397, https://github.com/noDRM/DeDRM_tools/issues/346

Trung0246 commented 1 month ago

Edit: I think I found the issue. Looks like Kobo sometimes decidedly "unlock" a book. For anyone reading this the temp fix is simply just uninstall Kobo and make sure wipe out everything then install Kobo again then download books back.

No idea why the behavior is very random since it's sometimes correctly "lock" the book and able to decrypt it with no issue and sometimes falsely "unlock". So I guess just treat it like gacha.

Edit 2: Ok so I figured out why Obok failed to decrypt. Look like the order of the books in the library matter. So the simplest way to "fix" while waiting for the actual fix is just download all of the book except the last one in the "My Book" library. When decrypted all successfully, simply read the last book in Kobo to bump it to the first order. Then uninstall Kobo to wipe the database to clean state (probably could uninstall Calibre too but I didn't test this). Then install Kobo again alongside with Calibre and the Obok plugin. Then download the faulty book and decrypt it.

ElleKayEm commented 1 month ago

Are you closing Kobo Desktop before using Obok? That's what fixes the "green open lock" (on books which do have DRM) problem for me.

There are some fixes for Obok in version 10.0.9. Probably won't make a difference with this, but just thought I'd mention it.