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:
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Read meta information from fb2 files
|
||||
"""
|
||||
import mimetypes
|
||||
import functools
|
||||
import os
|
||||
import random
|
||||
@@ -225,7 +226,7 @@ def _parse_cover_data(root, imgid, mi, ctx):
|
||||
mime_extensions = guess_all_extensions(mimetype)
|
||||
|
||||
if not mime_extensions and mimetype.startswith('image/'):
|
||||
mimetype_fromid = guess_type(imgid)[0]
|
||||
mimetype_fromid = mimetypes.guess_type(imgid)[0]
|
||||
if mimetype_fromid and mimetype_fromid.startswith('image/'):
|
||||
mime_extensions = guess_all_extensions(mimetype_fromid)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user