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:
gryf committed 2020-06-14 15:41:18 +02:00
1 parent b23a59f223
commit 1465e4267f
22 files changed
+94 -112

No files matched your search

+3 -1
View File
@@ -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'))