From aea692a112eab58d5a468d4d90c620d8227489da Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 28 Jun 2016 20:38:41 -0700 Subject: [PATCH] Fix applying track index in per_disc_numbering Fixes #2085. This is the second half, which deals with actually applying the track number. The previous condition didn't acknowledge that `Item` coerced `None` to 0 to enforce its field types. --- beets/autotag/__init__.py | 5 +++-- docs/changelog.rst | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/beets/autotag/__init__.py b/beets/autotag/__init__.py index ef775f6ec..b3cfa9541 100644 --- a/beets/autotag/__init__.py +++ b/beets/autotag/__init__.py @@ -97,8 +97,9 @@ def apply_metadata(album_info, mapping): if config['per_disc_numbering']: # We want to let the track number be zero, but if the medium index # is not provided we need to fall back to the overall index. - item.track = track_info.medium_index - if item.track is None: + if track_info.medium_index is not None: + item.track = track_info.medium_index + else: item.track = track_info.index item.tracktotal = track_info.medium_total or len(album_info.tracks) else: diff --git a/docs/changelog.rst b/docs/changelog.rst index 7e51aabbc..6bf4a9681 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -23,6 +23,9 @@ Fixes: * :doc:`/plugins/permissions`: Fix a regression in the previous release where the plugin would always fail to set permissions (and log a warning). :bug:`2089` +* With :ref:`per_disc_numbering` enabled, some metadata sources (notably, the + :doc:`/plugins/beatport`) would not set the track number at all. This is + fixed. :bug:`2085` The last release, 1.3.19, also erroneously reported its version as "1.3.18" when you typed ``beet version``. This has been corrected.