tools v2.4

This commit is contained in:
Apprentice Alf
2010-12-15 21:21:51 +00:00
parent 9162698f89
commit 38eabe7612
23 changed files with 591 additions and 87 deletions

View File

@@ -475,7 +475,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, 1, 3) # The version number of this plugin
version = (0, 1, 4) # The version number of this plugin
file_types = set(['prc','mobi','azw']) # The file types that this plugin will be applied to
on_import = True # Run this plugin during the import
priority = 200 # run this plugin before mobidedrm, k4pcdedrm, k4dedrm
@@ -483,6 +483,24 @@ if not __name__ == "__main__" and inCalibre:
def run(self, path_to_ebook):
from calibre.gui2 import is_ok_to_use_qt
from PyQt4.Qt import QMessageBox
# Head Topaz files off at the pass and warn the user that they will NOT
# be decrypted. Changes the file extension from .azw or .prc to .tpz so
# Calibre can at least read the metadata properly and the user can find
# them by sorting on 'format'.
with open(path_to_ebook, 'rb') as f:
raw = f.read()
if raw.startswith('TPZ'):
tf = self.temporary_file('.tpz')
if is_ok_to_use_qt():
d = QMessageBox(QMessageBox.Warning, "K4MobiDeDRM Plugin", "%s is a Topaz book. It will NOT be decrypted!" % path_to_ebook)
d.show()
d.raise_()
d.exec_()
tf.write(raw)
tf.close
return tf.name
global kindleDatabase
global openKindleInfo, CryptUnprotectData, GetUserName, GetVolumeSerialNumber, charMap1, charMap2, charMap3, charMap4
if sys.platform.startswith('win'):

View File

@@ -39,8 +39,9 @@
# Removed the disabled Calibre plug-in code
# Permit use of 8-digit PIDs
# 0.19 - It seems that multibyte entries aren't encrypted in a v6 file either.
# 0.20 - Corretion: It seems that multibyte entries are encrypted in a v6 file.
__version__ = '0.19'
__version__ = '0.20'
import sys
import struct
@@ -208,8 +209,8 @@ class DrmStripper:
if (mobi_length >= 0xE4) and (mobi_version >= 5):
extra_data_flags, = struct.unpack('>H', sect[0xF2:0xF4])
print "Extra Data Flags = %d" %extra_data_flags
if mobi_version <= 5:
# multibyte utf8 data is included in the encryption for mobi_version 5 and below
if mobi_version < 7:
# 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.
extra_data_flags &= 0xFFFE