mirror of
https://github.com/beetbox/beets.git
synced 2026-02-10 17:34:05 +01:00
mediafile: Zero-padded date format
Tag files with '2000-08-01' instead of '2000-8-1'
This commit is contained in:
parent
832f34c46c
commit
7958469b25
1 changed files with 6 additions and 4 deletions
|
|
@ -1122,13 +1122,15 @@ class DateField(MediaField):
|
|||
"""
|
||||
if year is None:
|
||||
self.__delete__(mediafile)
|
||||
date = [year]
|
||||
return
|
||||
|
||||
date = [u'{0:04d}'.format(int(year))]
|
||||
if month:
|
||||
date.append(month)
|
||||
date.append(u'{0:02d}'.format(int(month)))
|
||||
if month and day:
|
||||
date.append(day)
|
||||
date.append(u'{0:02d}'.format(int(day)))
|
||||
date = map(unicode, date)
|
||||
super(DateField, self).__set__(mediafile, '-'.join(date))
|
||||
super(DateField, self).__set__(mediafile, u'-'.join(date))
|
||||
|
||||
if hasattr(self, '_year_field'):
|
||||
self._year_field.__set__(mediafile, year)
|
||||
|
|
|
|||
Loading…
Reference in a new issue