summaryrefslogtreecommitdiffstats
path: root/DeDRM_plugin/kfxdedrm.py
diff options
context:
space:
mode:
authorxxyzz <[email protected]>2020-11-28 11:20:53 +0800
committerxxyzz <[email protected]>2020-11-28 11:20:53 +0800
commit1955b348833b27a1b71f269351a044acd566ff85 (patch)
tree747ff9511372869eb6d2579981233f7a5a33eae6 /DeDRM_plugin/kfxdedrm.py
parent66bab7bd7d71568fcca9e0c52c79e3e707b3e3eb (diff)
import ion correctly
Diffstat (limited to 'DeDRM_plugin/kfxdedrm.py')
-rw-r--r--DeDRM_plugin/kfxdedrm.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/DeDRM_plugin/kfxdedrm.py b/DeDRM_plugin/kfxdedrm.py
index 8bacd87..4be73ea 100644
--- a/DeDRM_plugin/kfxdedrm.py
+++ b/DeDRM_plugin/kfxdedrm.py
@@ -11,6 +11,7 @@ import shutil
import zipfile
from io import BytesIO
+from calibre_plugins.dedrm.ion import DrmIon, DrmIonVoucher
__license__ = 'GPL v3'
@@ -27,10 +28,6 @@ class KFXZipBook:
return (None, None)
def processBook(self, totalpids):
- try:
- import ion
- except:
- from calibre_plugins.dedrm import ion
with zipfile.ZipFile(self.infile, 'r') as zf:
for filename in zf.namelist():
with zf.open(filename) as fh:
@@ -42,7 +39,7 @@ class KFXZipBook:
self.decrypt_voucher(totalpids)
print("Decrypting KFX DRMION: {0}".format(filename))
outfile = BytesIO()
- ion.DrmIon(BytesIO(data[8:-8]), lambda name: self.voucher).parse(outfile)
+ DrmIon(BytesIO(data[8:-8]), lambda name: self.voucher).parse(outfile)
self.decrypted[filename] = outfile.getvalue()
if not self.decrypted:
@@ -72,7 +69,7 @@ class KFXZipBook:
continue
try:
- voucher = ion.DrmIonVoucher(BytesIO(data), pid[:dsn_len], pid[dsn_len:])
+ voucher = DrmIonVoucher(BytesIO(data), pid[:dsn_len], pid[dsn_len:])
voucher.parse()
voucher.decryptvoucher()
break