]> xmof Git - DeDRM.git/commitdiff
Fix print-replica Amazon books
authorNoDRM <no_drm123@protonmail.com>
Sat, 19 Mar 2022 15:41:59 +0000 (16:41 +0100)
committerNoDRM <no_drm123@protonmail.com>
Sat, 19 Mar 2022 15:41:59 +0000 (16:41 +0100)
CHANGELOG.md
DeDRM_plugin/mobidedrm.py

index 92d667076bf59ae23e46b609e0b1886ce09c4fad..4cb498bd2bc3d303a9a4f9467fca5c79d25151a9 100644 (file)
@@ -61,4 +61,6 @@ List of changes since the fork of Apprentice Harper's repository:
 - Add support for books with the new ADE3.0+ DRM by merging #48 by a980e066a01. Thanks a lot!
 - Remove OpenSSL support, now the plugin will always use the Python crypto libraries.
 - Obok: Fix issues with invalid UTF-8 characters by merging #26 by baby-bell.
-- Try to fix PDF files with V3 key obfuscation algorithm.
+- ineptpdf: Fix broken V=3 key obfuscation algorithm. 
+- ineptpdf: (Hopefully) fix issues with some B&N PDF files.
+- Fix bug that corrupts output file for Print-Replica Amazon books (fixes #30).
index c57b884d1b0ae76a4055a4d0b6f6396fa95c8a50..902edd156449cdd1e994aa2389a35bde43671207 100755 (executable)
@@ -453,7 +453,7 @@ class MobiBook:
         if crypto_type == 0:
             print("This book is not encrypted.")
             # we must still check for Print Replica
-            self.print_replica = (self.loadSection(1)[0:4] == '%MOP')
+            self.print_replica = (self.loadSection(1)[0:4] == b'%MOP')
             self.mobi_data = self.data_file
             return
         if crypto_type != 2 and crypto_type != 1:
@@ -524,7 +524,7 @@ class MobiBook:
             # print "record %d, extra_size %d" %(i,extra_size)
             decoded_data = PC1(found_key, data[0:len(data) - extra_size])
             if i==1:
-                self.print_replica = (decoded_data[0:4] == '%MOP')
+                self.print_replica = (decoded_data[0:4] == b'%MOP')
             mobidataList.append(decoded_data)
             if extra_size > 0:
                 mobidataList.append(data[-extra_size:])