py3: make rb metadata reading work

This commit is contained in:
Eli Schwartz 2019-04-29 02:02:36 -04:00
parent 42cb67abb3
commit c478c978ef
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6

View File

@ -8,7 +8,7 @@ import sys, struct
from calibre.ebooks.metadata import MetaInformation, string_to_authors
from polyglot.builtins import unicode_type
MAGIC = '\xb0\x0c\xb0\x0c\x02\x00NUVO\x00\x00\x00\x00'
MAGIC = b'\xb0\x0c\xb0\x0c\x02\x00NUVO\x00\x00\x00\x00'
def get_metadata(stream):
@ -37,7 +37,7 @@ def get_metadata(stream):
return mi
stream.seek(offset)
info = stream.read(length).splitlines()
info = stream.read(length).decode().splitlines()
for line in info:
if '=' not in line:
continue