Skip to content

Commit

Permalink
whitespace and some unicode/bytes
Browse files Browse the repository at this point in the history
Minor changes.
  • Loading branch information
apprenticeharper committed Apr 11, 2021
1 parent 45a1a64 commit 73af5d3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion DeDRM_plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'


Expand Down Expand Up @@ -76,6 +76,7 @@
# 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.
Expand Down
6 changes: 6 additions & 0 deletions DeDRM_plugin/ion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions DeDRM_plugin/kfxdedrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# 2.0 - Python 3 for calibre 5.0
# 2.1 - Some fixes for debugging
# 2.1.1 - Whitespace!


import os
Expand Down Expand Up @@ -67,7 +68,7 @@ def decrypt_voucher(self, totalpids):
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)]:
Expand All @@ -82,8 +83,8 @@ def decrypt_voucher(self, totalpids):
voucher.decryptvoucher()
break
except:
traceback.print_exc()
pass
traceback.print_exc()
pass
else:
raise Exception("Failed to decrypt KFX DRM voucher with any key")

Expand Down
4 changes: 2 additions & 2 deletions Obok_plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
print_function)

__license__ = 'GPL v3'
__version__ = '7.2.0'
__version__ = '7.2.1'
__docformat__ = 'restructuredtext en'

#####################################################################
Expand All @@ -20,7 +20,7 @@
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'
Expand Down

0 comments on commit 73af5d3

Please sign in to comment.