From a372df833379248cd7f077a6fcafe6bee646e98b Mon Sep 17 00:00:00 2001 From: Tobias Sauerwein Date: Fri, 26 Jul 2013 12:20:29 +0200 Subject: [PATCH 1/2] Scanner: Add disc number to album and track models (fixes #318) --- mopidy/scanner.py | 2 ++ tests/scanner_test.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mopidy/scanner.py b/mopidy/scanner.py index 77085f90..9f13d454 100644 --- a/mopidy/scanner.py +++ b/mopidy/scanner.py @@ -139,6 +139,7 @@ def translator(data): _retrieve(gst.TAG_ALBUM, 'name', album_kwargs) _retrieve(gst.TAG_TRACK_COUNT, 'num_tracks', album_kwargs) + _retrieve(gst.TAG_ALBUM_VOLUME_COUNT, 'num_discs', album_kwargs) _retrieve(gst.TAG_ARTIST, 'name', artist_kwargs) if gst.TAG_DATE in data and data[gst.TAG_DATE]: @@ -152,6 +153,7 @@ def translator(data): _retrieve(gst.TAG_TITLE, 'name', track_kwargs) _retrieve(gst.TAG_TRACK_NUMBER, 'track_no', track_kwargs) + _retrieve(gst.TAG_ALBUM_VOLUME_NUMBER, 'disc_no', track_kwargs) # Following keys don't seem to have TAG_* constant. _retrieve('album-artist', 'name', albumartist_kwargs) diff --git a/tests/scanner_test.py b/tests/scanner_test.py index c9671523..224aa77f 100644 --- a/tests/scanner_test.py +++ b/tests/scanner_test.py @@ -26,6 +26,8 @@ class TranslatorTest(unittest.TestCase): 'album-artist': 'albumartistname', 'title': 'trackname', 'track-count': 2, + 'album-disc-number': 2, + 'album-disc-count': 3, 'date': FakeGstDate(2006, 1, 1,), 'container-format': 'ID3 tag', 'duration': 4531, @@ -39,6 +41,7 @@ class TranslatorTest(unittest.TestCase): self.album = { 'name': 'albumname', 'num_tracks': 2, + 'num_discs': 3, 'musicbrainz_id': 'mbalbumid', } @@ -56,7 +59,8 @@ class TranslatorTest(unittest.TestCase): 'uri': 'uri', 'name': 'trackname', 'date': '2006-01-01', - 'track_no': 1, + 'track_no': 1, + 'disc_no': 2, 'length': 4531, 'musicbrainz_id': 'mbtrackid', 'last_modified': 1234, From d1051e4f18298e963ba09daf1463ea78024546f1 Mon Sep 17 00:00:00 2001 From: Tobias Sauerwein Date: Fri, 26 Jul 2013 12:30:02 +0200 Subject: [PATCH 2/2] Removed unnecessary whitespaces. --- tests/scanner_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/scanner_test.py b/tests/scanner_test.py index 224aa77f..dcf891c0 100644 --- a/tests/scanner_test.py +++ b/tests/scanner_test.py @@ -59,7 +59,7 @@ class TranslatorTest(unittest.TestCase): 'uri': 'uri', 'name': 'trackname', 'date': '2006-01-01', - 'track_no': 1, + 'track_no': 1, 'disc_no': 2, 'length': 4531, 'musicbrainz_id': 'mbtrackid',