diff options
author | NoDRM <[email protected]> | 2022-03-19 15:23:07 +0100 |
---|---|---|
committer | NoDRM <[email protected]> | 2022-03-19 15:23:07 +0100 |
commit | e4fe032e4719e87e004b2f36e433051bf3345b85 (patch) | |
tree | c80f6bca2bb2e2abc5aac2e5091de9ad63f1355b /DeDRM_plugin | |
parent | bb170688ba67557de2400f377ab907b991437b30 (diff) |
Some untested Python2 Kindle bugfixes
Diffstat (limited to 'DeDRM_plugin')
-rw-r--r-- | DeDRM_plugin/k4mobidedrm.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/DeDRM_plugin/k4mobidedrm.py b/DeDRM_plugin/k4mobidedrm.py index ec108d4..e048a03 100644 --- a/DeDRM_plugin/k4mobidedrm.py +++ b/DeDRM_plugin/k4mobidedrm.py @@ -69,7 +69,11 @@ import getopt import re import traceback import time -import html.entities +try: + import html.entities as htmlentitydefs +except: + import htmlentitydefs + import json #@@CALIBRE_COMPAT_CODE@@ @@ -188,7 +192,7 @@ def unescape(text): else: # named entity try: - text = chr(html.entities.name2codepoint[text[1:-1]]) + text = chr(htmlentitydefs.name2codepoint[text[1:-1]]) except KeyError: pass return text # leave as is @@ -215,8 +219,11 @@ def GetDecryptedBook(infile, kDatabases, androidFiles, serials, pids, starttime else: mb = topazextract.TopazBook(infile) - bookname = unescape(mb.getBookTitle()) - print("Decrypting {1} ebook: {0}".format(bookname, mb.getBookType())) + try: + bookname = unescape(mb.getBookTitle()) + print("Decrypting {1} ebook: {0}".format(bookname, mb.getBookType())) + except: + print("Decrypting {0} ebook.".format(mb.getBookType())) # copy list of pids totalpids = list(pids) |