From 8805ba28fdc25ad90f29bab4da1f7a72305faa35 Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Tue, 17 Dec 2019 16:33:41 -0500 Subject: [PATCH] Add comments --- beetsplug/discogs.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index ea3239c21..7e398072b 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -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: