Scanner: set date to track and album
This commit is contained in:
parent
70e510e459
commit
18a3f6801c
@ -19,6 +19,9 @@ Feature release.
|
|||||||
- MPD: Add ``nextsong`` and ``nextsongid`` to the response of MPD ``status`` command.
|
- MPD: Add ``nextsong`` and ``nextsongid`` to the response of MPD ``status`` command.
|
||||||
(Fixes: :issue:`1133`, :issue:`1516`, PR: :issue:`1523`)
|
(Fixes: :issue:`1133`, :issue:`1516`, PR: :issue:`1523`)
|
||||||
|
|
||||||
|
- Audio: The scanner set the date to :attr:`mopidy.models.Track.date` and
|
||||||
|
:attr:`mopidy.models.Album.date`
|
||||||
|
(Fixes: :issue:`1741`)
|
||||||
|
|
||||||
v2.0.1 (2016-08-16)
|
v2.0.1 (2016-08-16)
|
||||||
===================
|
===================
|
||||||
|
|||||||
@ -124,6 +124,7 @@ def convert_tags_to_track(tags):
|
|||||||
datetime = tags.get(Gst.TAG_DATE_TIME, [None])[0]
|
datetime = tags.get(Gst.TAG_DATE_TIME, [None])[0]
|
||||||
if datetime is not None:
|
if datetime is not None:
|
||||||
album_kwargs['date'] = datetime.split('T')[0]
|
album_kwargs['date'] = datetime.split('T')[0]
|
||||||
|
track_kwargs['date'] = album_kwargs['date']
|
||||||
|
|
||||||
# Clear out any empty values we found
|
# Clear out any empty values we found
|
||||||
track_kwargs = {k: v for k, v in track_kwargs.items() if v}
|
track_kwargs = {k: v for k, v in track_kwargs.items() if v}
|
||||||
|
|||||||
@ -120,7 +120,7 @@ class TagsToTrackTest(unittest.TestCase):
|
|||||||
num_tracks=2, num_discs=3,
|
num_tracks=2, num_discs=3,
|
||||||
musicbrainz_id='albumid', artists=[albumartist])
|
musicbrainz_id='albumid', artists=[albumartist])
|
||||||
|
|
||||||
self.track = Track(name='track',
|
self.track = Track(name='track', date='2006-01-01',
|
||||||
genre='genre', track_no=1, disc_no=2,
|
genre='genre', track_no=1, disc_no=2,
|
||||||
comment='comment', musicbrainz_id='trackid',
|
comment='comment', musicbrainz_id='trackid',
|
||||||
album=album, bitrate=1000, artists=[artist],
|
album=album, bitrate=1000, artists=[artist],
|
||||||
@ -184,7 +184,9 @@ class TagsToTrackTest(unittest.TestCase):
|
|||||||
def test_missing_track_date(self):
|
def test_missing_track_date(self):
|
||||||
del self.tags['date']
|
del self.tags['date']
|
||||||
self.check(
|
self.check(
|
||||||
self.track.replace(album=self.track.album.replace(date=None)))
|
self.track.replace(
|
||||||
|
album=self.track.album.replace(date=None)
|
||||||
|
).replace(date=None))
|
||||||
|
|
||||||
def test_multiple_track_date(self):
|
def test_multiple_track_date(self):
|
||||||
self.tags['date'].append('2030-01-01')
|
self.tags['date'].append('2030-01-01')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user