Use parse_only_date when reading pubdate from filenames

This commit is contained in:
Kovid Goyal 2014-01-08 08:33:46 +05:30
parent 3c10e66274
commit 632e5105e8

View File

@ -82,7 +82,8 @@ def get_metadata(stream, stream_type='lrf', use_libprs_metadata=False,
def _get_metadata(stream, stream_type, use_libprs_metadata, def _get_metadata(stream, stream_type, use_libprs_metadata,
force_read_metadata=False, pattern=None): force_read_metadata=False, pattern=None):
if stream_type: stream_type = stream_type.lower() if stream_type:
stream_type = stream_type.lower()
if stream_type in ('html', 'html', 'xhtml', 'xhtm', 'xml'): if stream_type in ('html', 'html', 'xhtml', 'xhtm', 'xml'):
stream_type = 'html' stream_type = 'html'
if stream_type in ('mobi', 'prc', 'azw'): if stream_type in ('mobi', 'prc', 'azw'):
@ -187,8 +188,8 @@ def metadata_from_filename(name, pat=None):
try: try:
pubdate = match.group('published') pubdate = match.group('published')
if pubdate: if pubdate:
from calibre.utils.date import parse_date from calibre.utils.date import parse_only_date
mi.pubdate = parse_date(pubdate) mi.pubdate = parse_only_date(pubdate)
except: except:
pass pass