summaryrefslogtreecommitdiffstats
path: root/DeDRM_Windows_Application
diff options
context:
space:
mode:
authorApprentice Alf <[email protected]>2011-02-24 23:42:37 +0000
committerApprentice Alf <[email protected]>2015-03-05 17:42:55 +0000
commit867ac35b4555f0a48ab27310fb08462270b9f375 (patch)
treeac171706a3246a3059cd1a8614975c5079839bdd /DeDRM_Windows_Application
parent427137b0fe37cfee547b4cdc44a7574a10acb755 (diff)
tools v3.7
Diffstat (limited to 'DeDRM_Windows_Application')
-rw-r--r--DeDRM_Windows_Application/DeDRM_WinApp/DeDRM_lib/lib/k4mobidedrm.py4
-rw-r--r--DeDRM_Windows_Application/DeDRM_WinApp/DeDRM_lib/lib/mobidedrm.py8
2 files changed, 8 insertions, 4 deletions
diff --git a/DeDRM_Windows_Application/DeDRM_WinApp/DeDRM_lib/lib/k4mobidedrm.py b/DeDRM_Windows_Application/DeDRM_WinApp/DeDRM_lib/lib/k4mobidedrm.py
index 3a0000e..d165f37 100644
--- a/DeDRM_Windows_Application/DeDRM_WinApp/DeDRM_lib/lib/k4mobidedrm.py
+++ b/DeDRM_Windows_Application/DeDRM_WinApp/DeDRM_lib/lib/k4mobidedrm.py
@@ -29,7 +29,7 @@ from __future__ import with_statement
# and import that ZIP into Calibre using its plugin configuration GUI.
-__version__ = '2.6'
+__version__ = '2.7'
class Unbuffered:
def __init__(self, stream):
@@ -250,7 +250,7 @@ if not __name__ == "__main__" and inCalibre:
Provided by the work of many including DiapDealer, SomeUpdates, IHeartCabbages, CMBDTC, Skindle, DarkReverser, ApprenticeAlf, etc.'
supported_platforms = ['osx', 'windows', 'linux'] # Platforms this plugin will run on
author = 'DiapDealer, SomeUpdates' # The author of this plugin
- version = (0, 2, 6) # The version number of this plugin
+ version = (0, 2, 7) # The version number of this plugin
file_types = set(['prc','mobi','azw','azw1','tpz']) # The file types that this plugin will be applied to
on_import = True # Run this plugin during the import
priority = 210 # run this plugin before mobidedrm, k4pcdedrm, k4dedrm
diff --git a/DeDRM_Windows_Application/DeDRM_WinApp/DeDRM_lib/lib/mobidedrm.py b/DeDRM_Windows_Application/DeDRM_WinApp/DeDRM_lib/lib/mobidedrm.py
index e660a1a..7aef175 100644
--- a/DeDRM_Windows_Application/DeDRM_WinApp/DeDRM_lib/lib/mobidedrm.py
+++ b/DeDRM_Windows_Application/DeDRM_WinApp/DeDRM_lib/lib/mobidedrm.py
@@ -48,8 +48,11 @@
# 0.26 - Now enables Text-To-Speech flag and sets clipping limit to 100%
# 0.27 - Correct pid metadata token generation to match that used by skindle (Thank You Bart!)
# 0.28 - slight additional changes to metadata token generation (None -> '')
+# 0.29 - It seems that the ideas about when multibyte trailing characters were
+# included in the encryption were wrong. They aren't for DOC compressed
+# files, but they are for HUFF/CDIC compress files!
-__version__ = '0.28'
+__version__ = '0.29'
import sys
@@ -177,6 +180,7 @@ class MobiBook:
# parse information from section 0
self.sect = self.loadSection(0)
self.records, = struct.unpack('>H', self.sect[0x8:0x8+2])
+ self.compression, = struct.unpack('>H', self.sect[0x0:0x0+2])
if self.magic == 'TEXtREAd':
print "Book has format: ", self.magic
@@ -192,7 +196,7 @@ class MobiBook:
if (self.mobi_length >= 0xE4) and (self.mobi_version >= 5):
self.extra_data_flags, = struct.unpack('>H', self.sect[0xF2:0xF4])
print "Extra Data Flags = %d" % self.extra_data_flags
- if self.mobi_version < 7:
+ if (self.mobi_version < 7) and (self.compression != 17480):
# multibyte utf8 data is included in the encryption for mobi_version 6 and below
# so clear that byte so that we leave it to be decrypted.
self.extra_data_flags &= 0xFFFE