2020-09-27 04:54:49 -06:00
|
|
|
#!/usr/bin/env python3
|
2012-12-19 06:48:11 -07:00
|
|
|
# -*- coding: utf-8 -*-
|
2010-11-11 15:11:36 -07:00
|
|
|
|
2021-12-29 03:36:59 -07:00
|
|
|
#@@CALIBRE_COMPAT_CODE@@
|
2021-12-29 01:26:29 -07:00
|
|
|
|
|
|
|
from ignoblekeyGenPassHash import generate_key
|
2020-01-20 07:17:06 -07:00
|
|
|
|
2013-10-02 12:59:40 -06:00
|
|
|
__license__ = 'GPL v3'
|
|
|
|
|
|
|
|
DETAILED_MESSAGE = \
|
|
|
|
'You have personal information stored in this plugin\'s customization '+ \
|
|
|
|
'string from a previous version of this plugin.\n\n'+ \
|
|
|
|
'This new version of the plugin can convert that info '+ \
|
|
|
|
'into key data that the new plugin can then use (which doesn\'t '+ \
|
|
|
|
'require personal information to be stored/displayed in an insecure '+ \
|
|
|
|
'manner like the old plugin did).\n\nIf you choose NOT to migrate this data at this time '+ \
|
|
|
|
'you will be prompted to save that personal data to a file elsewhere; and you\'ll have '+ \
|
|
|
|
'to manually re-configure this plugin with your information.\n\nEither way... ' + \
|
|
|
|
'this new version of the plugin will not be responsible for storing that personal '+ \
|
|
|
|
'info in plain sight any longer.'
|
|
|
|
|
|
|
|
def uStrCmp (s1, s2, caseless=False):
|
|
|
|
import unicodedata as ud
|
2020-10-14 09:23:49 -06:00
|
|
|
str1 = s1 if isinstance(s1, str) else str(s1)
|
|
|
|
str2 = s2 if isinstance(s2, str) else str(s2)
|
2013-10-02 12:59:40 -06:00
|
|
|
if caseless:
|
|
|
|
return ud.normalize('NFC', str1.lower()) == ud.normalize('NFC', str2.lower())
|
2013-01-19 07:50:57 -07:00
|
|
|
else:
|
2013-10-02 12:59:40 -06:00
|
|
|
return ud.normalize('NFC', str1) == ud.normalize('NFC', str2)
|
2013-01-19 07:50:57 -07:00
|
|
|
|
2013-10-02 12:59:40 -06:00
|
|
|
def parseCustString(keystuff):
|
|
|
|
userkeys = []
|
|
|
|
ar = keystuff.split(':')
|
|
|
|
for i in ar:
|
2013-01-19 07:50:57 -07:00
|
|
|
try:
|
2013-10-02 12:59:40 -06:00
|
|
|
name, ccn = i.split(',')
|
|
|
|
# Generate Barnes & Noble EPUB user key from name and credit card number.
|
|
|
|
userkeys.append(generate_key(name, ccn))
|
2013-01-19 07:50:57 -07:00
|
|
|
except:
|
|
|
|
pass
|
2013-10-02 12:59:40 -06:00
|
|
|
return userkeys
|