mirror of
https://github.com/noDRM/DeDRM_tools.git
synced 2024-11-05 13:36:10 +06:00
Some untested Python2 Kindle bugfixes
This commit is contained in:
parent
bb170688ba
commit
e4fe032e47
|
@ -69,7 +69,11 @@ import getopt
|
||||||
import re
|
import re
|
||||||
import traceback
|
import traceback
|
||||||
import time
|
import time
|
||||||
import html.entities
|
try:
|
||||||
|
import html.entities as htmlentitydefs
|
||||||
|
except:
|
||||||
|
import htmlentitydefs
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
#@@CALIBRE_COMPAT_CODE@@
|
#@@CALIBRE_COMPAT_CODE@@
|
||||||
|
@ -188,7 +192,7 @@ def unescape(text):
|
||||||
else:
|
else:
|
||||||
# named entity
|
# named entity
|
||||||
try:
|
try:
|
||||||
text = chr(html.entities.name2codepoint[text[1:-1]])
|
text = chr(htmlentitydefs.name2codepoint[text[1:-1]])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
return text # leave as is
|
return text # leave as is
|
||||||
|
@ -215,8 +219,11 @@ def GetDecryptedBook(infile, kDatabases, androidFiles, serials, pids, starttime
|
||||||
else:
|
else:
|
||||||
mb = topazextract.TopazBook(infile)
|
mb = topazextract.TopazBook(infile)
|
||||||
|
|
||||||
bookname = unescape(mb.getBookTitle())
|
try:
|
||||||
print("Decrypting {1} ebook: {0}".format(bookname, mb.getBookType()))
|
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
|
# copy list of pids
|
||||||
totalpids = list(pids)
|
totalpids = list(pids)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user