Version to 6.6.3 with update for kindle book name cleanup and .kinf2018 support (initial)

This commit is contained in:
Apprentice Harper 2019-03-30 15:02:40 +00:00
parent b17b913839
commit 3d0aa17b2e
5 changed files with 29 additions and 12 deletions

View File

@ -34,7 +34,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>6.6.2</string>
<string>6.6.3</string>
<key>CFBundleSignature</key>
<string>dplt</string>
<key>LSMinimumSystemVersionByArchitecture</key>

View File

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# DeDRM.pyw
# Copyright 2010-2016 some_updates, Apprentice Alf and Apprentice Harper
# Copyright 2010-2019 some_updates, Apprentice Alf and Apprentice Harper
# Revision history:
# 6.0.0 - Release along with unified plugin
@ -34,8 +34,9 @@
# 6.6.0 - Initial KFX support from TomThumb
# 6.6.1 - Standalong app fix from wzyboy
# 6.6.2 - Version bump for 64-bit Mac OS X app and various fixes.
# 6.6.3 - Version bump for Kindle book name fixes and start of support for .kinf2018
__version__ = '6.6.2'
__version__ = '6.6.3'
import sys
import os, os.path

View File

@ -4,9 +4,10 @@
from __future__ import with_statement
# __init__.py for DeDRM_plugin
# Copyright © 2008-2018 Apprentice Harper et al.
# Copyright © 2008-2019 Apprentice Harper et al.
__license__ = 'GPL v3'
__version__ = '6.6.3'
__docformat__ = 'restructuredtext en'
@ -67,6 +68,7 @@ __docformat__ = 'restructuredtext en'
# imported format was azw8 since that may be converted to kfx)
# 6.6.1 - Thanks to wzyboy for a fix for stand-alone tools, and the new folder structure.
# 6.6.2 - revamp of folders to get Mac OS X app working. Updated to 64-bit app. Various fixes.
# 6.6.3 - More cleanup of kindle book names and start of support for .kinf2018
"""
@ -74,7 +76,7 @@ Decrypt DRMed ebooks.
"""
PLUGIN_NAME = u"DeDRM"
PLUGIN_VERSION_TUPLE = (6, 6, 2)
PLUGIN_VERSION_TUPLE = (6, 6, 3)
PLUGIN_VERSION = u".".join([unicode(str(x)) for x in PLUGIN_VERSION_TUPLE])
# Include an html helpfile in the plugin's zipfile with the following name.
RESOURCE_NAME = PLUGIN_NAME + '_Help.htm'

View File

@ -4,10 +4,10 @@
from __future__ import with_statement
# k4mobidedrm.py
# Copyright © 2008-2017 by Apprentice Harper et al.
# Copyright © 2008-2019 by Apprentice Harper et al.
__license__ = 'GPL v3'
__version__ = '5.5'
__version__ = '5.7'
# Engine to remove drm from Kindle and Mobipocket ebooks
# for personal use for archiving and converting your ebooks
@ -60,7 +60,8 @@ __version__ = '5.5'
# 5.3 - Changed Android support to allow passing of backup .ab files
# 5.4 - Recognise KFX files masquerading as azw, even if we can't decrypt them yet.
# 5.5 - Added GPL v3 licence explicitly.
# 5.x - Invoke KFXZipBook to handle zipped KFX files
# 5.6 - Invoke KFXZipBook to handle zipped KFX files
# 5.7 - Revamp cleanup_name
import sys, os, re
import csv
@ -155,19 +156,24 @@ def unicode_argv():
# added in removal of control (<32) chars
# and removal of . at start and end
# and with some (heavily edited) code from Paul Durrant's kindlenamer.py
# and some improvements suggested by jhaisley
def cleanup_name(name):
# substitute filename unfriendly characters
name = name.replace(u"<",u"[").replace(u">",u"]").replace(u" : ",u" ").replace(u": ",u" ").replace(u":",u"").replace(u"/",u"_").replace(u"\\",u"_").replace(u"|",u"_").replace(u"\"",u"\'").replace(u"*",u"_").replace(u"?",u"")
# delete control characters
name = u"".join(char for char in name if ord(char)>=32)
# white space to single space, delete leading and trailing while space
name = re.sub(ur"\s", u" ", name).strip()
# delete control characters
name = u"".join(char for char in name if ord(char)>=32)
# delete non-ascii characters
name = u"".join(char for char in name if ord(char)<=126)
# remove leading dots
while len(name)>0 and name[0] == u".":
name = name[1:]
# remove trailing dots (Windows doesn't like them)
if name.endswith(u'.'):
while name.endswith(u'.'):
name = name[:-1]
if len(name)==0:
name=u"DecryptedBook"
return name
# must be passed unicode

View File

@ -7,7 +7,7 @@ from __future__ import with_statement
# Copyright © 2008-2017 Apprentice Harper et al.
__license__ = 'GPL v3'
__version__ = '2.5'
__version__ = '2.6'
# Revision history:
# 1.0 - Kindle info file decryption, extracted from k4mobidedrm, etc.
@ -28,6 +28,7 @@ __version__ = '2.5'
# 2.3 - Added more field names thanks to concavegit's KFX code.
# 2.4 - Fix for complex Mac disk setups, thanks to Tibs
# 2.5 - Final Fix for Windows user names with non-ascii characters, thanks to oneofusoneofus
# 2.6 - Start adding support for Kindle 2.25+ .kinf2018 file
"""
@ -973,6 +974,13 @@ if iswindows:
# Probably not the best. To Fix (shouldn't ignore in encoding) or use utf-8
print(u'searching for kinfoFiles in ' + path.encode('ascii', 'ignore'))
# look for (K4PC 2.25.1and later) .kinf2018 file
kinfopath = path +'\\Amazon\\Kindle\\storage\\.kinf2018'
if os.path.isfile(kinfopath):
found = True
print('Found K4PC 2.25+ kinf2018 file: ' + kinfopath.encode('ascii','ignore'))
kInfoFiles.append(kinfopath)
# look for (K4PC 1.9.0 and later) .kinf2011 file
kinfopath = path +'\\Amazon\\Kindle\\storage\\.kinf2011'
if os.path.isfile(kinfopath):