summaryrefslogtreecommitdiffstats
path: root/DeDRM_plugin/k4mobidedrm.py
diff options
context:
space:
mode:
authorApprentice Harper <[email protected]>2020-10-04 20:36:12 +0100
committerApprentice Harper <[email protected]>2020-10-04 20:36:12 +0100
commite31752e3347ca7cc867e1ced37f17c7cab8fb5fe (patch)
treed9ae314dacbfd9673cf5785e1d3380687b1c8f63 /DeDRM_plugin/k4mobidedrm.py
parent2eb31c8fb5f2f9fe2179516b6265cfe877388a96 (diff)
Mostly Mac fixes. mobidedrm.py now works, and k4mobidedrm for at least some input. kindlekey.py should be working too. But lots more changes and testing to do.
Diffstat (limited to 'DeDRM_plugin/k4mobidedrm.py')
-rw-r--r--DeDRM_plugin/k4mobidedrm.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/DeDRM_plugin/k4mobidedrm.py b/DeDRM_plugin/k4mobidedrm.py
index 18addc2..d7775d6 100644
--- a/DeDRM_plugin/k4mobidedrm.py
+++ b/DeDRM_plugin/k4mobidedrm.py
@@ -146,10 +146,8 @@ def unicode_argv():
# this should never happen
return ["mobidedrm.py"]
else:
- argvencoding = sys.stdin.encoding
- if argvencoding == None:
- argvencoding = "utf-8"
- return argv
+ argvencoding = sys.stdin.encoding or "utf-8"
+ return [arg if isinstance(arg, str) else str(arg, argvencoding) for arg in sys.argv]
# cleanup unicode filenames
# borrowed from calibre from calibre/src/calibre/__init__.py
@@ -337,7 +335,7 @@ def cli_main():
if o == "-p":
if a == None :
raise DrmException("Invalid parameter for -p")
- pids = a.split(',')
+ pids = a.encode('utf-8').split(b',')
if o == "-s":
if a == None :
raise DrmException("Invalid parameter for -s")