Cleanup / SafeUnbuffered bugfix

This commit is contained in:
NoDRM 2022-08-07 09:30:24 +02:00
parent ca6d30b2d9
commit b12e567c5f
2 changed files with 3 additions and 15 deletions

View File

@ -134,7 +134,7 @@ except:
config_dir = "" config_dir = ""
from utilities import SafeUnbuffered import utilities
PLUGIN_NAME = __version.PLUGIN_NAME PLUGIN_NAME = __version.PLUGIN_NAME
@ -998,8 +998,8 @@ class DeDRM(FileTypePlugin):
def run(self, path_to_ebook): def run(self, path_to_ebook):
# make sure any unicode output gets converted safely with 'replace' # make sure any unicode output gets converted safely with 'replace'
sys.stdout=SafeUnbuffered(sys.stdout) sys.stdout=utilities.SafeUnbuffered(sys.stdout)
sys.stderr=SafeUnbuffered(sys.stderr) sys.stderr=utilities.SafeUnbuffered(sys.stderr)
print("{0} v{1}: Trying to decrypt {2}".format(PLUGIN_NAME, PLUGIN_VERSION, os.path.basename(path_to_ebook))) print("{0} v{1}: Trying to decrypt {2}".format(PLUGIN_NAME, PLUGIN_VERSION, os.path.basename(path_to_ebook)))
self.starttime = time.time() self.starttime = time.time()

View File

@ -3,7 +3,6 @@
#@@CALIBRE_COMPAT_CODE@@ #@@CALIBRE_COMPAT_CODE@@
from ignoblekeyGenPassHash import generate_key
import sys import sys
__license__ = 'GPL v3' __license__ = 'GPL v3'
@ -22,17 +21,6 @@ def uStrCmp (s1, s2, caseless=False):
else: else:
return ud.normalize('NFC', str1) == ud.normalize('NFC', str2) return ud.normalize('NFC', str1) == ud.normalize('NFC', str2)
def parseCustString(keystuff):
userkeys = []
ar = keystuff.split(':')
for i in ar:
try:
name, ccn = i.split(',')
# Generate Barnes & Noble EPUB user key from name and credit card number.
userkeys.append(generate_key(name, ccn))
except:
pass
return userkeys
# Wrap a stream so that output gets flushed immediately # Wrap a stream so that output gets flushed immediately