diff --git a/app/playlistmodel.py b/app/playlistmodel.py index 8d1796a..1f08448 100644 --- a/app/playlistmodel.py +++ b/app/playlistmodel.py @@ -497,16 +497,34 @@ class PlaylistModel(QAbstractTableModel): # There was no start of section return prd.note if row_prd.note.endswith(("+", "=")): + # If we are playing this section, also + # calculate end time if all tracks are played. + end_time_str = "" + if ( + track_sequence.now.plr_rownum + and track_sequence.now.end_time + and ( + row_number + < track_sequence.now.plr_rownum + < prd.plr_rownum + ) + ): + section_end_time = track_sequence.now.end_time + timedelta( + milliseconds=duration + ) + end_time_str = ", section end time " + section_end_time.strftime( + Config.TRACK_TIME_FORMAT + ) stripped_note = prd.note[:-1].strip() if stripped_note: return ( f"{stripped_note} [{count} track{'s' if count > 1 else ''}, " - f"{ms_to_mmss(duration)} unplayed]" + f"{ms_to_mmss(duration)} unplayed{end_time_str}]" ) else: return ( f"[Subtotal: {count} track{'s' if count > 1 else ''}, " - f"{ms_to_mmss(duration, none='none')} unplayed]" + f"{ms_to_mmss(duration, none='none')} unplayed{end_time_str}]" ) else: continue