]> xmof Git - DeDRM.git/commitdiff
Version to 6.6.3 with update for kindle book name cleanup and .kinf2018 support ...
authorApprentice Harper <apprenticeharper@gmail.com>
Sat, 30 Mar 2019 15:02:40 +0000 (15:02 +0000)
committerApprentice Harper <apprenticeharper@gmail.com>
Sat, 30 Mar 2019 15:02:40 +0000 (15:02 +0000)
contrib/DeDRM_Macintosh_Application/DeDRM.app/Contents/Info.plist
contrib/DeDRM_Windows_Application/DeDRM_App/DeDRM_lib/DeDRM_App.pyw
dedrm_src/__init__.py
dedrm_src/k4mobidedrm.py
dedrm_src/kindlekey.py

index 68cce80eabb23503dcfdcffb26c5e01f857e3641..c21a09dca5bd02bc452a9b63a7bd3114a9d76df1 100644 (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>
index 241ad871b0006437cbf1a3c28e8cf425a1b69345..82e2c79ec49183d03a941ff2f60d28841d517a91 100644 (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
index bb10cc5164d6f37c6aa5b2eab7e4b5ad94c8a32f..cdd4e7b15b1c40ff39599fa9f575579cb736dc16 100644 (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'
index c6ab3ab72a756af41921eaccc4f95d212699e4bb..3ac753e41d8dec6f56c95d6156bf8e29beb9e3ab 100644 (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
index 39526c08df41ab8f35aa1d8dc6eb14220c26641f..b9f459c03e322c6a17ffd5a52d4f418260af2926 100644 (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):