1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-07 21:43:31 +02:00

Sorted out mime initialization.

Every mime related function in main __init__.py has a flag check for the
check if initialization has already done. This is nonsense, since it
should be done implicitly early on the converter is starting.

This commit straight the things out, and initialization is done in cli
module.

Also, function guess_type was removed, since it's just a proxy for
mimetypes.guess_type function.
This commit is contained in:
2020-06-14 15:41:18 +02:00
parent b23a59f223
commit 1465e4267f
22 changed files with 94 additions and 112 deletions

View File

@@ -1,3 +1,4 @@
import mimetypes
import re
from ebook_converter.ebooks.oeb.base import XPath, urlunquote
from ebook_converter.polyglot.builtins import as_bytes
@@ -45,5 +46,6 @@ class DataURL(object):
self.log('Found image encoded as data URI converting it to normal image')
from ebook_converter import guess_type
item_id, item_href = oeb.manifest.generate('data-url-image', 'data-url-image.' + fmt)
oeb.manifest.add(item_id, item_href, guess_type(item_href)[0], data=data)
oeb.manifest.add(item_id, item_href,
mimetypes.guess_type(item_href)[0], data=data)
return item_href