]> xmof Git - DeDRM.git/commitdiff
whitespace and some unicode/bytes
authorApprentice Harper <apprenticeharper@gmail.com>
Sun, 11 Apr 2021 15:43:16 +0000 (16:43 +0100)
committerApprentice Harper <apprenticeharper@gmail.com>
Sun, 11 Apr 2021 15:43:16 +0000 (16:43 +0100)
Minor changes.

DeDRM_plugin/__init__.py
DeDRM_plugin/ion.py
DeDRM_plugin/kfxdedrm.py
Obok_plugin/__init__.py

index 173db21b31f05d00b08b6e79c0afe5d7349744b3..8af84b195ad670cb197fab8f1781e0c88858ed74 100644 (file)
@@ -5,7 +5,7 @@
 # Copyright © 2008-2020 Apprentice Harper et al.
 
 __license__   = 'GPL v3'
-__version__ = '7.2.0'
+__version__ = '7.2.1'
 __docformat__ = 'restructuredtext en'
 
 
@@ -76,6 +76,7 @@ __docformat__ = 'restructuredtext en'
 #   7.0.3 - More Python 3 changes. Integer division in ineptpdf.py
 #   7.1.0 - Full release for calibre 5.x
 #   7.2.0 - Update for latest KFX changes, and Python 3 Obok fixes.
+#   7.2.1 - Whitespace!
 
 """
 Decrypt DRMed ebooks.
index 9e9dc0c912a17ad809404e1bfdbe20b67bb387f4..f102ec5fbf7acd0372434db124cc53344e25b1d9 100644 (file)
@@ -848,6 +848,12 @@ class DrmIonVoucher(object):
     def __init__(self, voucherenv, dsn, secret):
         self.dsn, self.secret = dsn, secret
 
+        if isinstance(dsn, str):
+            self.dsn = dsn.encode('ASCII')
+
+        if isinstance(secret, str):
+            self.secret = secret.encode('ASCII')
+
         self.lockparams = []
 
         self.envelope = BinaryIonParser(voucherenv)
index d6b0e1f153816b6774cc23af452d158213598f9e..67b10f8c2621f35e66dfa3b1da04309bb6b352dc 100644 (file)
@@ -5,6 +5,7 @@
 
 #  2.0   - Python 3 for calibre 5.0
 #  2.1   - Some fixes for debugging
+#  2.1.1 - Whitespace!
 
 
 import os
@@ -67,7 +68,7 @@ class KFXZipBook:
         print("Decrypting KFX DRM voucher: {0}".format(info.filename))
 
         for pid in [''] + totalpids:
-               # Belt and braces. PIDs should be unicode strings, but just in case...
+            # Belt and braces. PIDs should be unicode strings, but just in case...
             if isinstance(pid, bytes):
                 pid = pid.decode('ascii')
             for dsn_len,secret_len in [(0,0), (16,0), (16,40), (32,40), (40,0), (40,40)]:
@@ -82,8 +83,8 @@ class KFXZipBook:
                 voucher.decryptvoucher()
                 break
             except:
-                               traceback.print_exc()
-                    pass
+                traceback.print_exc()
+                pass
         else:
             raise Exception("Failed to decrypt KFX DRM voucher with any key")
 
index 722c088b81d7ebbf02ddc066741f3cbd2689c93a..60daad37d4fceb3bc3f58bce7d8fba04b6d38833 100644 (file)
@@ -3,7 +3,7 @@ from __future__ import (unicode_literals, division, absolute_import,
                         print_function)
 
 __license__   = 'GPL v3'
-__version__ = '7.2.0'
+__version__ = '7.2.1'
 __docformat__ = 'restructuredtext en'
 
 #####################################################################
@@ -20,7 +20,7 @@ except NameError:
 PLUGIN_NAME = 'Obok DeDRM'
 PLUGIN_SAFE_NAME = PLUGIN_NAME.strip().lower().replace(' ', '_')
 PLUGIN_DESCRIPTION = _('Removes DRM from Kobo kepubs and adds them to the library.')
-PLUGIN_VERSION_TUPLE = (7, 2, 0)
+PLUGIN_VERSION_TUPLE = (7, 2, 1)
 PLUGIN_VERSION = '.'.join([str(x) for x in PLUGIN_VERSION_TUPLE])
 HELPFILE_NAME = PLUGIN_SAFE_NAME + '_Help.htm'
 PLUGIN_AUTHORS = 'Anon'