Skip to content

Commit

Permalink
tools v3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
apprenticealf committed Mar 5, 2015
1 parent 2bedd75 commit ac9cdb1
Show file tree
Hide file tree
Showing 16 changed files with 191 additions and 934 deletions.
Binary file modified Calibre_Plugins/k4mobidedrm_plugin.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions Calibre_Plugins/k4mobidedrm_plugin/k4mobidedrm_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# and import that ZIP into Calibre using its plugin configuration GUI.


__version__ = '2.3'
__version__ = '2.4'

class Unbuffered:
def __init__(self, stream):
Expand Down Expand Up @@ -250,7 +250,7 @@ class K4DeDRM(FileTypePlugin):
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, 3) # The version number of this plugin
version = (0, 2, 4) # 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
Expand Down
27 changes: 13 additions & 14 deletions Calibre_Plugins/k4mobidedrm_plugin/mobidedrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@
# 0.24 - add support for type 1 encryption and 'TEXtREAd' books as well
# 0.25 - Fixed support for 'BOOKMOBI' type 1 encryption
# 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!)

__version__ = '0.26'
__version__ = '0.27'

import sys

Expand Down Expand Up @@ -207,19 +208,16 @@ def __init__(self, infile):
pos = 12
for i in xrange(nitems):
type, size = struct.unpack('>II', exth[pos: pos + 8])
content = exth[pos + 8: pos + size]
self.meta_array[type] = content
# reset the text to speech flag and clipping limit, if present
if type == 401 and size == 9:
# set clipping limit to 100%
self.patchSection(0, "\144", 16 + self.mobi_length + pos + 8)
content = "\144"
elif type == 404 and size == 9:
# make sure text to speech is enabled
self.patchSection(0, "\0", 16 + self.mobi_length + pos + 8)
content = "\0"
else:
content = exth[pos + 8: pos + size]
#print type, size, content
self.meta_array[type] = content
# print type, size, content, content.encode('hex')
pos += size
except:
self.meta_array = {}
Expand All @@ -244,13 +242,14 @@ def getPIDMetaInfo(self):
if 209 in self.meta_array:
rec209 = self.meta_array[209]
data = rec209
# Parse the 209 data to find the the exth record with the token data.
# The last character of the 209 data points to the record with the token.
# Always 208 from my experience, but I'll leave the logic in case that changes.
for i in xrange(len(data)):
if ord(data[i]) != 0:
if self.meta_array[ord(data[i])] != None:
token = self.meta_array[ord(data[i])]
token = ''
# The 209 data comes in five byte groups. Interpret the last four bytes
# of each group as a big endian unsigned integer to get a key value
# if that key exists in the meta_array, append its contents to the token
for i in xrange(0,len(data),5):
val, = struct.unpack('>I',data[i+1:i+5])
sval = self.meta_array.get(val,'')
token += sval
return rec209, token

def patch(self, off, new):
Expand Down
4 changes: 2 additions & 2 deletions DeDRM_Macintosh_Application/DeDRM.app/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<key>CFBundleExecutable</key>
<string>droplet</string>
<key>CFBundleGetInfoString</key>
<string>DeDRM 2.2, Copyright © 2010–2011 by Apprentice Alf and others.</string>
<string>DeDRM 2.3, Copyright © 2010–2011 by Apprentice Alf and others.</string>
<key>CFBundleIconFile</key>
<string>droplet</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -34,7 +34,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.2</string>
<string>2.3</string>
<key>CFBundleSignature</key>
<string>dplt</string>
<key>LSMinimumSystemVersion</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# and import that ZIP into Calibre using its plugin configuration GUI.


__version__ = '2.3'
__version__ = '2.4'

class Unbuffered:
def __init__(self, stream):
Expand Down Expand Up @@ -250,7 +250,7 @@ class K4DeDRM(FileTypePlugin):
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, 3) # The version number of this plugin
version = (0, 2, 4) # 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@
# 0.24 - add support for type 1 encryption and 'TEXtREAd' books as well
# 0.25 - Fixed support for 'BOOKMOBI' type 1 encryption
# 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!)

__version__ = '0.26'
__version__ = '0.27'

import sys

Expand Down Expand Up @@ -207,19 +208,16 @@ def __init__(self, infile):
pos = 12
for i in xrange(nitems):
type, size = struct.unpack('>II', exth[pos: pos + 8])
content = exth[pos + 8: pos + size]
self.meta_array[type] = content
# reset the text to speech flag and clipping limit, if present
if type == 401 and size == 9:
# set clipping limit to 100%
self.patchSection(0, "\144", 16 + self.mobi_length + pos + 8)
content = "\144"
elif type == 404 and size == 9:
# make sure text to speech is enabled
self.patchSection(0, "\0", 16 + self.mobi_length + pos + 8)
content = "\0"
else:
content = exth[pos + 8: pos + size]
#print type, size, content
self.meta_array[type] = content
# print type, size, content, content.encode('hex')
pos += size
except:
self.meta_array = {}
Expand All @@ -244,13 +242,14 @@ def getPIDMetaInfo(self):
if 209 in self.meta_array:
rec209 = self.meta_array[209]
data = rec209
# Parse the 209 data to find the the exth record with the token data.
# The last character of the 209 data points to the record with the token.
# Always 208 from my experience, but I'll leave the logic in case that changes.
for i in xrange(len(data)):
if ord(data[i]) != 0:
if self.meta_array[ord(data[i])] != None:
token = self.meta_array[ord(data[i])]
token = ''
# The 209 data comes in five byte groups. Interpret the last four bytes
# of each group as a big endian unsigned integer to get a key value
# if that key exists in the meta_array, append its contents to the token
for i in xrange(0,len(data),5):
val, = struct.unpack('>I',data[i+1:i+5])
sval = self.meta_array.get(val,'')
token += sval
return rec209, token

def patch(self, off, new):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# and import that ZIP into Calibre using its plugin configuration GUI.


__version__ = '2.3'
__version__ = '2.4'

class Unbuffered:
def __init__(self, stream):
Expand Down Expand Up @@ -250,7 +250,7 @@ class K4DeDRM(FileTypePlugin):
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, 3) # The version number of this plugin
version = (0, 2, 4) # 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
Expand Down
27 changes: 13 additions & 14 deletions DeDRM_Windows_Application/DeDRM_WinApp/DeDRM_lib/lib/mobidedrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@
# 0.24 - add support for type 1 encryption and 'TEXtREAd' books as well
# 0.25 - Fixed support for 'BOOKMOBI' type 1 encryption
# 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!)

__version__ = '0.26'
__version__ = '0.27'

import sys

Expand Down Expand Up @@ -207,19 +208,16 @@ def __init__(self, infile):
pos = 12
for i in xrange(nitems):
type, size = struct.unpack('>II', exth[pos: pos + 8])
content = exth[pos + 8: pos + size]
self.meta_array[type] = content
# reset the text to speech flag and clipping limit, if present
if type == 401 and size == 9:
# set clipping limit to 100%
self.patchSection(0, "\144", 16 + self.mobi_length + pos + 8)
content = "\144"
elif type == 404 and size == 9:
# make sure text to speech is enabled
self.patchSection(0, "\0", 16 + self.mobi_length + pos + 8)
content = "\0"
else:
content = exth[pos + 8: pos + size]
#print type, size, content
self.meta_array[type] = content
# print type, size, content, content.encode('hex')
pos += size
except:
self.meta_array = {}
Expand All @@ -244,13 +242,14 @@ def getPIDMetaInfo(self):
if 209 in self.meta_array:
rec209 = self.meta_array[209]
data = rec209
# Parse the 209 data to find the the exth record with the token data.
# The last character of the 209 data points to the record with the token.
# Always 208 from my experience, but I'll leave the logic in case that changes.
for i in xrange(len(data)):
if ord(data[i]) != 0:
if self.meta_array[ord(data[i])] != None:
token = self.meta_array[ord(data[i])]
token = ''
# The 209 data comes in five byte groups. Interpret the last four bytes
# of each group as a big endian unsigned integer to get a key value
# if that key exists in the meta_array, append its contents to the token
for i in xrange(0,len(data),5):
val, = struct.unpack('>I',data[i+1:i+5])
sval = self.meta_array.get(val,'')
token += sval
return rec209, token

def patch(self, off, new):
Expand Down
2 changes: 1 addition & 1 deletion DeDRM_Windows_Application/ReadMe_DeDRM_WinApp.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ReadMe_DeDRM_WinApp_v1.2
ReadMe_DeDRM_WinApp_v1.5
-----------------------

DeDRM_WinApp is a pure python drag and drop application that allows users to drag and drop ebooks or folders of ebooks onto theDeDRM_Drop_Target to have the DRM removed. It repackages the"tools" python software in one easy to use program.
Expand Down
Loading

0 comments on commit ac9cdb1

Please sign in to comment.