scanner: Ignore invalid dates
This commit is contained in:
parent
c54a9c3260
commit
4889d2a928
@ -19,6 +19,9 @@ v0.10.0 (in development)
|
||||
``glib``. The bug can be worked around by overriding the settings that
|
||||
includes offending `$XDG_` variables.
|
||||
|
||||
- Make ``mopidy-scan`` ignore invalid dates, e.g. dates in years outside the
|
||||
range 1-9999.
|
||||
|
||||
|
||||
v0.9.0 (2012-11-21)
|
||||
===================
|
||||
|
||||
@ -62,8 +62,12 @@ def translator(data):
|
||||
|
||||
if gst.TAG_DATE in data and data[gst.TAG_DATE]:
|
||||
date = data[gst.TAG_DATE]
|
||||
date = datetime.date(date.year, date.month, date.day)
|
||||
track_kwargs['date'] = date
|
||||
try:
|
||||
date = datetime.date(date.year, date.month, date.day)
|
||||
except ValueError:
|
||||
pass # Ignore invalid dates
|
||||
else:
|
||||
track_kwargs['date'] = date.isoformat()
|
||||
|
||||
_retrieve(gst.TAG_TITLE, 'name', track_kwargs)
|
||||
_retrieve(gst.TAG_TRACK_NUMBER, 'track_no', track_kwargs)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user