Skip to content

Commit

Permalink
Don't warn about a mid-page instrumental more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
WinslowJosiah committed Mar 5, 2025
1 parent 5373c82 commit d9a1236
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ def _calculate_instrumental_time(
> last_syllable_page
)
# If this syllable is not the last one in this page
if not syllable_is_last_in_page:
if not instrumental._warned and not syllable_is_last_in_page:
# Warn the user
logger.warning(
"instrumentals should not be triggered in the middle "
Expand All @@ -1267,6 +1267,7 @@ def _calculate_instrumental_time(
for li in range(lyric.lines_per_page)
)
)
instrumental._warned = True

# If this line is being actively sung, and this is the last
# syllable in this line
Expand Down
3 changes: 3 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ class SettingsInstrumental:
transition: str | None = None
x: int = 0
y: int = 0
# HACK This property exists to ensure that only one warning is
# logged for starting an instrumental in the middle of a page.
_warned: bool = False


@define
Expand Down

0 comments on commit d9a1236

Please sign in to comment.