diff --git a/app/playlists.py b/app/playlists.py index 31ad712..c9c731b 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -994,6 +994,18 @@ class PlaylistTab(QTableWidget): # Set colours and start times next_start_time = None + # Don't change start times for tracks that have been played. + # For unplayed tracks, if there's a 'current' or 'next' + # track marked, populate start times from then onwards. If + # neither, populate start times from first note with a start + # time. + if current and next: + start_times_row = min(current, next) + else: + start_times_row = current or next + if not start_times_row: + start_times_row = 0 + # Cycle through all rows for row in range(self.rowCount()): # We can't calculate start times until next_start_time is @@ -1074,12 +1086,16 @@ class PlaylistTab(QTableWidget): self._set_row_not_bold(row) else: # Set start/end times only if we haven't played it yet - if next_start_time: + if next_start_time and row >= start_times_row: self._set_row_start_time(row, next_start_time) next_start_time = self._calculate_next_start_time( session, row, next_start_time) # Set end time self._set_row_end_time(row, next_start_time) + else: + # Clear start and end time + self._set_row_start_time(row, None) + self._set_row_end_time(row, None) # Don't dim unplayed tracks self._set_row_bold(row)