mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-10 15:13:35 +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,5 +1,6 @@
|
||||
import shutil, os, re, struct, textwrap, io
|
||||
import logging
|
||||
import mimetypes
|
||||
|
||||
from lxml import html, etree
|
||||
|
||||
@@ -674,7 +675,8 @@ class MobiReader(object):
|
||||
for i in getattr(self, 'image_names', []):
|
||||
path = os.path.join(bp, 'images', i)
|
||||
added.add(path)
|
||||
manifest.append((path, guess_type(path)[0] or 'image/jpeg'))
|
||||
manifest.append((path,
|
||||
mimetypes.guess_type(path)[0] or 'image/jpeg'))
|
||||
if cover_copied is not None:
|
||||
manifest.append((cover_copied, 'image/jpeg'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user