Add comments

This commit is contained in:
Cole Miller 2019-12-17 16:33:41 -05:00
parent 02e03be93d
commit 8805ba28fd

View file

@ -398,12 +398,14 @@ class DiscogsPlugin(BeetsPlugin):
tracks = []
index_tracks = {}
index = 0
# Distinct works and intra-work divisions, as defined by index tracks.
divisions, next_divisions = [], []
for track in clean_tracklist:
# Only real tracks have `position`. Otherwise, it's an index track.
if track['position']:
index += 1
if next_divisions:
# End of a block of index tracks: update the current divisions.
divisions += next_divisions
next_divisions.clear()
track_info = self.get_track_info(track, index, divisions)
@ -411,6 +413,8 @@ class DiscogsPlugin(BeetsPlugin):
tracks.append(track_info)
else:
next_divisions.append(track['title'])
# We expect new levels of division at the beginning of the tracklist
# (and possibly elsewhere).
try:
divisions.pop()
except IndexError: