Python 3 fix for epubtest.py that detects version of DRM used
This commit is contained in:
parent
5ec9c98a0b
commit
45038cc77b
|
@ -169,12 +169,12 @@ def getfiledata(file, zi):
|
||||||
|
|
||||||
def encryption(infile):
|
def encryption(infile):
|
||||||
# returns encryption: one of Unencrypted, Adobe, B&N and Unknown
|
# returns encryption: one of Unencrypted, Adobe, B&N and Unknown
|
||||||
encryption = "Unknown"
|
encryption = "Error When Checking."
|
||||||
try:
|
try:
|
||||||
with open(infile,'rb') as infileobject:
|
with open(infile,'rb') as infileobject:
|
||||||
bookdata = infileobject.read(58)
|
bookdata = infileobject.read(58)
|
||||||
# Check for Zip
|
# Check for Zip
|
||||||
if bookdata[0:0+2] == "PK":
|
if bookdata[0:0+2] == b"PK":
|
||||||
foundrights = False
|
foundrights = False
|
||||||
foundencryption = False
|
foundencryption = False
|
||||||
inzip = zipfile.ZipFile(infile,'r')
|
inzip = zipfile.ZipFile(infile,'r')
|
||||||
|
@ -198,6 +198,9 @@ def encryption(infile):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
argv=unicode_argv()
|
argv=unicode_argv()
|
||||||
|
if len(argv) < 2:
|
||||||
|
print("Give an ePub file as a parameter.")
|
||||||
|
else:
|
||||||
print(encryption(argv[1]))
|
print(encryption(argv[1]))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue