mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
commit
0b5003ab10
@ -18,7 +18,7 @@ from calibre.ebooks.chardet import substitute_entites
|
|||||||
from calibre.ebooks.oeb.base import XHTML_NS
|
from calibre.ebooks.oeb.base import XHTML_NS
|
||||||
from calibre.ptempfile import PersistentTemporaryDirectory
|
from calibre.ptempfile import PersistentTemporaryDirectory
|
||||||
from calibre.utils.config import config_dir
|
from calibre.utils.config import config_dir
|
||||||
from calibre.utils.date import format_date, isoformat, now as nowf
|
from calibre.utils.date import format_date, isoformat, is_date_undefined, now as nowf
|
||||||
from calibre.utils.icu import capitalize
|
from calibre.utils.icu import capitalize
|
||||||
from calibre.utils.logging import default_log as log
|
from calibre.utils.logging import default_log as log
|
||||||
from calibre.utils.zipfile import ZipFile, ZipInfo
|
from calibre.utils.zipfile import ZipFile, ZipInfo
|
||||||
@ -1559,7 +1559,7 @@ then rebuild the catalog.\n''').format(author[0],author[1],current_author[1])
|
|||||||
|
|
||||||
this_title['rating'] = record['rating'] if record['rating'] else 0
|
this_title['rating'] = record['rating'] if record['rating'] else 0
|
||||||
|
|
||||||
if re.match('0101-01-01',str(record['pubdate'].date())):
|
if is_date_undefined(record['pubdate']):
|
||||||
this_title['date'] = None
|
this_title['date'] = None
|
||||||
else:
|
else:
|
||||||
this_title['date'] = strftime(u'%B %Y', record['pubdate'].timetuple())
|
this_title['date'] = strftime(u'%B %Y', record['pubdate'].timetuple())
|
||||||
@ -2675,8 +2675,7 @@ then rebuild the catalog.\n''').format(author[0],author[1],current_author[1])
|
|||||||
# Use series, series index if avail else just title
|
# Use series, series index if avail else just title
|
||||||
#aTag.insert(0,'%d. %s · %s' % (book['series_index'],escape(book['title']), ' & '.join(book['authors'])))
|
#aTag.insert(0,'%d. %s · %s' % (book['series_index'],escape(book['title']), ' & '.join(book['authors'])))
|
||||||
|
|
||||||
# Reassert 'date' since this is the result of a new search
|
if is_date_undefined(book['pubdate']):
|
||||||
if re.match('0101-01-01',str(book['pubdate'].date())):
|
|
||||||
book['date'] = None
|
book['date'] = None
|
||||||
else:
|
else:
|
||||||
book['date'] = strftime(u'%B %Y', book['pubdate'].timetuple())
|
book['date'] = strftime(u'%B %Y', book['pubdate'].timetuple())
|
||||||
|
@ -48,6 +48,8 @@ UNDEFINED_DATE = datetime(101,1,1, tzinfo=utc_tz)
|
|||||||
|
|
||||||
def is_date_undefined(qt_or_dt):
|
def is_date_undefined(qt_or_dt):
|
||||||
d = qt_or_dt
|
d = qt_or_dt
|
||||||
|
if d is None:
|
||||||
|
return True
|
||||||
if hasattr(d, 'toString'):
|
if hasattr(d, 'toString'):
|
||||||
d = datetime(d.year(), d.month(), d.day(), tzinfo=utc_tz)
|
d = datetime(d.year(), d.month(), d.day(), tzinfo=utc_tz)
|
||||||
return d.year == UNDEFINED_DATE.year and \
|
return d.year == UNDEFINED_DATE.year and \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user