summaryrefslogtreecommitdiffstats
path: root/DeDRM_plugin/kfxdedrm.py
diff options
context:
space:
mode:
authorNoDRM <[email protected]>2021-12-29 09:26:29 +0100
committerNoDRM <[email protected]>2021-12-29 09:26:29 +0100
commitdbf4b5402614d2f714559f91e7b7d414efa892a5 (patch)
tree99ac8e93dbc2c7dfe77746735c1851280e37c5ba /DeDRM_plugin/kfxdedrm.py
parent9c40b3ce5a0e2d3f0c74e6a816947a81778a3c4b (diff)
Begin work on standalone version
Now the plugin ZIP file (DeDRM_plugin.zip) can be run with a normal Python interpreter as if it were a Python file (try `python3 DeDRM_plugin.zip --help`). This way I can begin building a standalone version (that can run without Calibre) without having to duplicate a ton of code.
Diffstat (limited to 'DeDRM_plugin/kfxdedrm.py')
-rw-r--r--DeDRM_plugin/kfxdedrm.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/DeDRM_plugin/kfxdedrm.py b/DeDRM_plugin/kfxdedrm.py
index 23e46dc..0674d63 100644
--- a/DeDRM_plugin/kfxdedrm.py
+++ b/DeDRM_plugin/kfxdedrm.py
@@ -8,16 +8,18 @@
# 2.1.1 - Whitespace!
-import os
+import os, sys
import shutil
import traceback
import zipfile
from io import BytesIO
-try:
- from ion import DrmIon, DrmIonVoucher
-except:
- from calibre_plugins.dedrm.ion import DrmIon, DrmIonVoucher
+
+# Calibre stuff - so we can import from our ZIP without absolute module name
+sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
+
+from ion import DrmIon, DrmIonVoucher
+
__license__ = 'GPL v3'