Allow combined +- in header rows

This commit is contained in:
Keith Edmunds 2024-12-13 12:48:05 +00:00
parent ba32473f06
commit d0d3d5b09a
2 changed files with 4 additions and 2 deletions

View File

@ -95,6 +95,8 @@ class Config(object):
ROOT = os.environ.get("ROOT") or "/home/kae/music"
ROWS_FROM_ZERO = True
SCROLL_TOP_MARGIN = 3
SECTION_ENDINGS = ("-", "+-", "-+")
SECTION_STARTS = ("+", "+-", "-+")
SONGFACTS_ON_NEXT = False
START_GAP_WARNING_THRESHOLD = 300
TEXT_NO_TRACK_NO_NOTE = "[Section header]"

View File

@ -618,7 +618,7 @@ class PlaylistModel(QAbstractTableModel):
Process possible section timing directives embeded in header
"""
if rat.note.endswith("+"):
if rat.note.endswith(Config.SECTION_STARTS):
return self.start_of_timed_section_header(rat)
elif rat.note.endswith("="):
@ -1445,7 +1445,7 @@ class PlaylistModel(QAbstractTableModel):
for row_number in range(rat.row_number + 1, len(self.playlist_rows)):
row_rat = self.playlist_rows[row_number]
if self.is_header_row(row_number):
if row_rat.note.endswith("-"):
if row_rat.note.endswith(Config.SECTION_ENDINGS):
return (
f"{rat.note[:-1].strip()} "
f"[{count} tracks, {ms_to_mmss(duration)} unplayed]"