From 7658dc354c44e883c89227bfc32a38cf9d760578 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Mon, 22 Jul 2024 18:47:29 +0100 Subject: [PATCH] More track timing cleanups --- app/playlistmodel.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/app/playlistmodel.py b/app/playlistmodel.py index d52d646..d9a3015 100644 --- a/app/playlistmodel.py +++ b/app/playlistmodel.py @@ -1477,13 +1477,10 @@ class PlaylistModel(QAbstractTableModel): # Update current track details now so that they are available # when we deal with next track row which may be above current # track row. - self.playlist_rows[ - current_track_row - ].start_time = track_sequence.current.start_time - self.playlist_rows[ - current_track_row - ].end_time = track_sequence.current.end_time - update_rows.append(current_track_row) + self.playlist_rows[current_track_row].set_start( + update_rows, track_sequence.current.start_time + ) + if track_sequence.next: next_track_row = track_sequence.next.row_number @@ -1494,8 +1491,8 @@ class PlaylistModel(QAbstractTableModel): # unreadable tracks or for the current track, handled above. if ( prd.played + or row_number == current_track_row or (prd.path and file_is_unreadable(prd.path)) - or (current_track_row and row_number == current_track_row) ): continue @@ -1508,12 +1505,13 @@ class PlaylistModel(QAbstractTableModel): # Set start time for next row if we have a current track if ( - next_track_row - and row_number == next_track_row + row_number == next_track_row and track_sequence.current and track_sequence.current.end_time ): - next_start_time = prd.set_start(update_rows, track_sequence.current.end_time) + next_start_time = prd.set_start( + update_rows, track_sequence.current.end_time + ) continue # If we're between the current and next row, zero out