1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-03-01 06:05:55 +01: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,6 +1,7 @@
"""
Convert .fb2 files to .lrf
"""
import mimetypes
import os
import pkg_resources
import re
@@ -10,7 +11,6 @@ from lxml import etree
from ebook_converter import constants as const
from ebook_converter.customize.conversion import InputFormatPlugin
from ebook_converter.customize.conversion import OptionRecommendation
from ebook_converter import guess_type
FB2NS = 'http://www.gribuser.ru/xml/fictionbook/2.0'
@@ -152,7 +152,8 @@ class FB2Input(InputFormatPlugin):
break
opf = OPFCreator(os.getcwd(), mi)
entries = [(f2, guess_type(f2)[0]) for f2 in os.listdir(u'.')]
entries = [(f2, mimetypes.guess_type(f2)[0])
for f2 in os.listdir(u'.')]
opf.create_manifest(entries)
opf.create_spine(['index.xhtml'])
if cpath: