1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-26 00:11:28 +02:00

Removing couple of "buildins" polyglot types

This commit is contained in:
2020-04-20 20:22:50 +02:00
parent eac0b98d6f
commit c867f0321b
36 changed files with 85 additions and 109 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ import re
from ebook_converter import force_unicode
from ebook_converter.ebooks.metadata import MetaInformation
from ebook_converter.polyglot.builtins import string_or_bytes, int_to_byte
from ebook_converter.polyglot.builtins import int_to_byte
title_pat = re.compile(br'\{\\info.*?\{\\title(.*?)(?<!\\)\}', re.DOTALL)
author_pat = re.compile(br'\{\\info.*?\{\\author(.*?)(?<!\\)\}', re.DOTALL)
@@ -156,7 +156,7 @@ def create_metadata(stream, options):
md.append(r'{\title %s}'%(title,))
if options.authors:
au = options.authors
if not isinstance(au, string_or_bytes):
if not isinstance(au, (str, bytes)):
au = ', '.join(au)
author = encode(au)
md.append(r'{\author %s}'%(author,))
+2 -2
View File
@@ -12,7 +12,7 @@ from ebook_converter.ebooks.metadata.book.base import Metadata
from ebook_converter.ebooks.metadata.opf2 import dump_dict
from ebook_converter.utils.date import parse_date, isoformat, now
from ebook_converter.utils.localization import canonicalize_lang, lang_as_iso639_1
from ebook_converter.polyglot.builtins import iteritems, string_or_bytes
from ebook_converter.polyglot.builtins import iteritems
__license__ = 'GPL v3'
@@ -477,7 +477,7 @@ def metadata_to_xmp_packet(mi):
'authors':('dc:creator', True), 'tags':('dc:subject', False), 'publisher':('dc:publisher', False),
}):
val = mi.get(prop) or ()
if isinstance(val, string_or_bytes):
if isinstance(val, (str, bytes)):
val = [val]
create_sequence_property(dc, tag, val, ordered)
if not mi.is_null('pubdate'):