python3: more use of unicode_type

These metadata sources files are part of the infrastructure, not the
parts which are downloaded.
This commit is contained in:
Eli Schwartz 2019-03-19 17:40:01 -04:00
parent 83b055122a
commit e828a4bd98
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
2 changed files with 4 additions and 2 deletions

View File

@ -21,6 +21,7 @@ from calibre.ebooks.metadata.sources.base import create_log
from calibre.ebooks.metadata.sources.identify import identify
from calibre.ebooks.metadata.sources.covers import download_cover
from calibre.ebooks.metadata.sources.update import patch_plugins
from polyglot.builtins import unicode_type
def option_parser():
@ -99,7 +100,7 @@ def main(args=sys.argv):
log = buf.getvalue()
result = (metadata_to_opf(result) if opts.opf else
type(u'')(result).encode('utf-8'))
unicode_type(result).encode('utf-8'))
if opts.verbose:
print (log, file=sys.stderr)

View File

@ -27,6 +27,7 @@ from calibre.utils.html2text import html2text
from calibre.utils.icu import lower
from calibre.utils.date import UNDEFINED_DATE
from calibre.utils.formatter import EvalFormatter
from polyglot.builtins import unicode_type
# Download worker {{{
@ -471,7 +472,7 @@ def identify(log, abort, # {{{
for r in presults:
log('\n\n---')
try:
log(type(u'')(r))
log(unicode_type(r))
except TypeError:
log(repr(r))
if plog: