mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-16 02:53:33 +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:
@@ -1,9 +1,9 @@
|
||||
import mimetypes
|
||||
import os
|
||||
import re
|
||||
|
||||
from ebook_converter.ebooks.oeb import base
|
||||
from ebook_converter.utils.date import isoformat, now
|
||||
from ebook_converter import guess_type
|
||||
|
||||
|
||||
def meta_info_to_oeb_metadata(mi, m, log, override_input_metadata=False):
|
||||
@@ -156,9 +156,8 @@ class MergeMetadata(object):
|
||||
new_cover_item = None
|
||||
if cdata:
|
||||
id, href = self.oeb.manifest.generate('cover', 'cover.'+ext)
|
||||
new_cover_item = self.oeb.manifest.add(id, href,
|
||||
guess_type('cover.'+ext)[0],
|
||||
data=cdata)
|
||||
new_cover_item = self.oeb.manifest.add(
|
||||
id, href, mimetypes.guess_type('cover.'+ext)[0], data=cdata)
|
||||
self.oeb.guide.add('cover', 'Cover', href)
|
||||
if do_remove_old_cover:
|
||||
self.remove_old_cover(item, new_cover_item.href)
|
||||
|
||||
Reference in New Issue
Block a user