Move index handling inside coalesce_tracks

This commit is contained in:
Auguste Olivry 2021-01-05 16:14:36 +01:00
parent a391740614
commit 345cf6e39b

View file

@ -499,12 +499,18 @@ class DiscogsPlugin(BeetsPlugin):
else:
# Promote the subtracks to real tracks, discarding the
# index track, assuming the subtracks are physical tracks.
index_track = tracklist[-1]
index_track = tracklist.pop()
# Fix artists when they are specified on the index track.
if index_track.get('artists'):
for subtrack in subtracks:
if not subtrack.get('artists'):
subtrack['artists'] = index_track['artists']
# Concatenate index with track title when index_tracks
# option is set
if self.config['index_tracks']:
for subtrack in subtracks:
subtrack['title'] = '{}: {}'.format(
index_track['title'], subtrack['title'])
tracklist.extend(subtracks)
else:
# Merge the subtracks, pick a title, and append the new track.