mirror of
https://github.com/beetbox/beets.git
synced 2026-02-24 08:12:54 +01:00
use TrackInfo.index in apply_metadata
enumerate() no longer necessary.
This commit is contained in:
parent
d4c3ea74c6
commit
ee3214e0f9
2 changed files with 11 additions and 9 deletions
|
|
@ -120,7 +120,7 @@ def apply_metadata(items, album_info, per_disc_numbering=False):
|
|||
items must be ordered. If `per_disc_numbering`, then the track
|
||||
numbers are per-disc instead of per-release.
|
||||
"""
|
||||
for index, (item, track_info) in enumerate(zip(items, album_info.tracks)):
|
||||
for item, track_info in zip(items, album_info.tracks):
|
||||
# Album, artist, track count.
|
||||
if not item:
|
||||
continue
|
||||
|
|
@ -153,7 +153,7 @@ def apply_metadata(items, album_info, per_disc_numbering=False):
|
|||
if per_disc_numbering:
|
||||
item.track = track_info.medium_index
|
||||
else:
|
||||
item.track = index + 1
|
||||
item.track = track_info.index
|
||||
|
||||
# Disc and disc count.
|
||||
item.disc = track_info.medium
|
||||
|
|
|
|||
|
|
@ -77,11 +77,11 @@ def _make_item(title, track, artist='some artist'):
|
|||
})
|
||||
|
||||
def _make_trackinfo():
|
||||
ti = []
|
||||
ti.append(TrackInfo('one', None, 'some artist', length=1))
|
||||
ti.append(TrackInfo('two', None, 'some artist', length=1))
|
||||
ti.append(TrackInfo('three', None, 'some artist', length=1))
|
||||
return ti
|
||||
return [
|
||||
TrackInfo('one', None, 'some artist', length=1, index=1),
|
||||
TrackInfo('two', None, 'some artist', length=1, index=2),
|
||||
TrackInfo('three', None, 'some artist', length=1, index=3),
|
||||
]
|
||||
|
||||
class TrackDistanceTest(unittest.TestCase):
|
||||
def test_identical_tracks(self):
|
||||
|
|
@ -481,11 +481,11 @@ class ApplyTest(unittest.TestCase):
|
|||
trackinfo.append(TrackInfo(
|
||||
'oneNew', 'dfa939ec-118c-4d0f-84a0-60f3d1e6522c', medium=1,
|
||||
medium_index=1, artist_credit='trackArtistCredit',
|
||||
artist_sort='trackArtistSort',
|
||||
artist_sort='trackArtistSort', index=1,
|
||||
))
|
||||
trackinfo.append(TrackInfo('twoNew',
|
||||
'40130ed1-a27c-42fd-a328-1ebefb6caef4',
|
||||
medium=2, medium_index=1))
|
||||
medium=2, medium_index=1, index=2))
|
||||
self.info = AlbumInfo(
|
||||
tracks = trackinfo,
|
||||
artist = 'artistNew',
|
||||
|
|
@ -596,12 +596,14 @@ class ApplyCompilationTest(unittest.TestCase):
|
|||
'dfa939ec-118c-4d0f-84a0-60f3d1e6522c',
|
||||
'artistOneNew',
|
||||
'a05686fc-9db2-4c23-b99e-77f5db3e5282',
|
||||
index=1,
|
||||
))
|
||||
trackinfo.append(TrackInfo(
|
||||
'twoNew',
|
||||
'40130ed1-a27c-42fd-a328-1ebefb6caef4',
|
||||
'artistTwoNew',
|
||||
'80b3cf5e-18fe-4c59-98c7-e5bb87210710',
|
||||
index=2,
|
||||
))
|
||||
self.info = AlbumInfo(
|
||||
tracks = trackinfo,
|
||||
|
|
|
|||
Loading…
Reference in a new issue