1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-07 13:33: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:
2020-06-14 15:41:18 +02:00
parent b23a59f223
commit 1465e4267f
22 changed files with 94 additions and 112 deletions

View File

@@ -1,10 +1,11 @@
import mimetypes
import os
import shutil
import sys
from lxml import etree
from ebook_converter import walk, guess_type
from ebook_converter import walk
from ebook_converter.ebooks.metadata import authors_to_sort_string
from ebook_converter.ebooks.metadata import string_to_authors
from ebook_converter.ebooks.metadata.book.base import Metadata
@@ -150,7 +151,7 @@ class DOCX(object):
ext = name.rpartition('.')[-1].lower()
if ext in self.default_content_types:
return self.default_content_types[ext]
return guess_type(name)[0]
return mimetypes.guess_type(name)[0]
def read_package_relationships(self):
try: