WIP V3: end time of playing subsection implemented

This commit is contained in:
Keith Edmunds 2023-11-10 03:57:33 +00:00
parent f311721386
commit 9e9bc8b4c7

View File

@ -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