1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-14 09:33:32 +02:00

Move strftime to util.date module

In this patch strftime function is moved out of main __init__.py module
to util.date, where it belongs.
This commit is contained in:
2020-06-14 20:38:52 +02:00
parent fdd531f6e0
commit 3f8844832d
7 changed files with 93 additions and 90 deletions

View File

@@ -14,8 +14,8 @@ from ebook_converter.ebooks.conversion.preprocess import HTMLPreProcessor
from ebook_converter.ptempfile import PersistentTemporaryDirectory
from ebook_converter.utils.date import parse_date
from ebook_converter.utils.zipfile import ZipFile
from ebook_converter import extract, walk, filesystem_encoding
from ebook_converter.constants_old import __version__
from ebook_converter import extract, walk
from ebook_converter.constants_old import __version__, filesystem_encoding
DEBUG_README=b'''

View File

@@ -20,10 +20,10 @@ from math import ceil, floor
import bs4
from ebook_converter import (
__appname__, entity_to_unicode, fit_image, force_unicode, preferred_encoding
)
from ebook_converter.constants_old import filesystem_encoding
from ebook_converter import __appname__, entity_to_unicode, fit_image, \
force_unicode
from ebook_converter.constants_old import filesystem_encoding, \
preferred_encoding
from ebook_converter.devices.interface import DevicePlugin as Device
from ebook_converter.ebooks import ConversionError
from ebook_converter.ebooks.BeautifulSoup import html5_parser

View File

@@ -8,12 +8,11 @@ import urllib.parse
from xml.sax import saxutils
from ebook_converter import constants as const
from ebook_converter import strftime
from ebook_converter.utils import date
from ebook_converter.constants_old import iswindows
from ebook_converter.ebooks.oeb import base
from ebook_converter.ebooks.oeb.base import XPath, xml2text, urlnormalize
from ebook_converter.library.comments import comments_to_html, markdown
from ebook_converter.utils.date import is_date_undefined, as_local_time
from ebook_converter.ebooks.chardet import strip_encoding_declarations
from ebook_converter.ebooks.metadata import fmt_sidx, rating_to_stars
@@ -272,11 +271,11 @@ def render_jacket(mi, output_profile, alt_title='Unknown', alt_tags=[],
publisher = saxutils.escape(publisher)
try:
if is_date_undefined(mi.pubdate):
if date.is_date_undefined(mi.pubdate):
pubdate = ''
else:
dt = as_local_time(mi.pubdate)
pubdate = strftime('%Y', dt.timetuple())
dt = date.as_local_time(mi.pubdate)
pubdate = date.strftime('%Y', dt.timetuple())
except Exception:
pubdate = ''