From fc9f0615745727f1958d4f4043cffee57d876150 Mon Sep 17 00:00:00 2001 From: Diego Moreda Date: Mon, 17 Oct 2016 19:48:06 +0200 Subject: [PATCH 1/3] discogs: add tests for medium, medium_total Add three tests for the setting of tracks' medium and medium_total on the discogs plugin. test_parse_medium_numbers_single_medium is meant to fail due to #587. --- test/test_discogs.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/test_discogs.py b/test/test_discogs.py index 0dff77072..0f89ff923 100644 --- a/test/test_discogs.py +++ b/test/test_discogs.py @@ -92,6 +92,44 @@ class DGAlbumInfoTest(_common.TestCase): self.assertEqual(t[0].media, d.media) self.assertEqual(t[1].media, d.media) + def test_parse_medium_numbers_single_medium(self): + release = self._make_release_from_positions(['1', '2']) + d = DiscogsPlugin().get_album_info(release) + t = d.tracks + + self.assertEqual(d.mediums, 1) + self.assertEqual(t[0].medium, 1) + self.assertEqual(t[0].medium_total, 1) + self.assertEqual(t[1].medium, 1) + self.assertEqual(t[0].medium_total, 1) + + def test_parse_medium_numbers_two_mediums(self): + release = self._make_release_from_positions(['1-1', '2-1']) + d = DiscogsPlugin().get_album_info(release) + t = d.tracks + + self.assertEqual(d.mediums, 2) + self.assertEqual(t[0].medium, 1) + self.assertEqual(t[0].medium_total, 2) + self.assertEqual(t[1].medium, 2) + self.assertEqual(t[1].medium_total, 2) + + def test_parse_medium_numbers_two_mediums_two_sided(self): + release = self._make_release_from_positions(['A1', 'B1', 'C1']) + d = DiscogsPlugin().get_album_info(release) + t = d.tracks + + self.assertEqual(d.mediums, 2) + self.assertEqual(t[0].medium, 1) + self.assertEqual(t[0].medium_total, 2) + self.assertEqual(t[0].medium_index, 1) + self.assertEqual(t[1].medium, 1) + self.assertEqual(t[1].medium_total, 2) + self.assertEqual(t[1].medium_index, 2) + self.assertEqual(t[2].medium, 2) + self.assertEqual(t[2].medium_total, 2) + self.assertEqual(t[2].medium_index, 1) + def test_parse_track_indices(self): release = self._make_release_from_positions(['1', '2']) d = DiscogsPlugin().get_album_info(release) From 373cf19f8bbe5b445edf0829c5a6ed23b0cf7ed2 Mon Sep 17 00:00:00 2001 From: kooimens Date: Tue, 3 Nov 2015 19:57:05 +0100 Subject: [PATCH 2/3] Fix discogs disc field is set to zero Fixes #587. The disc field is only zero when there is only one medium, so I think this will do the trick. I wasn't able to reproduce the real problem within the code. This is just a small workaround. --- beetsplug/discogs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index 90aefba10..97834c500 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -335,6 +335,7 @@ class DiscogsPlugin(BeetsPlugin): index_count = 0 side_count = 0 index_count += 1 + medium_count = 1 if medium_count == 0 else medium_count track.medium, track.medium_index = medium_count, index_count # Get `disctitle` from Discogs index tracks. Assume that an index track From 2604bc8e7363b4bb8284435712ef2422b3eec527 Mon Sep 17 00:00:00 2001 From: Diego Moreda Date: Mon, 17 Oct 2016 20:02:17 +0200 Subject: [PATCH 3/3] discogs: update changelog for medium --- docs/changelog.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index c24fc6606..8213b9741 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -74,7 +74,8 @@ And there are a few bug fixes too: the items. :bug:`1938` * :doc:`/plugins/discogs`: Subtracks are now detected and combined into a single track, two-sided mediums are treated as single discs, and tracks - have ``media`` and ``medium_total`` set correctly. :bug:`2222` + have ``media``, ``medium_total`` and ``medium`` set correctly. :bug:`2222` + :bug:`2228`. The last release, 1.3.19, also erroneously reported its version as "1.3.18" when you typed ``beet version``. This has been corrected.