diff --git a/app/config.py b/app/config.py index 4a0295a..68e96da 100644 --- a/app/config.py +++ b/app/config.py @@ -61,6 +61,7 @@ class Config(object): HIDE_AFTER_PLAYING_OFFSET = 5000 INFO_TAB_TITLE_LENGTH = 15 INTRO_SECONDS_FORMAT = ".1f" + INTRO_SECONDS_WARNING_MS = 3000 LAST_PLAYED_TODAY_STRING = "Today" LAST_PLAYED_TOOLTIP_DATE_FORMAT = "%a, %d %b %Y" LOG_LEVEL_STDERR = logging.INFO diff --git a/app/musicmuster.py b/app/musicmuster.py index 2d79156..a0d18d7 100755 --- a/app/musicmuster.py +++ b/app/musicmuster.py @@ -1715,15 +1715,17 @@ class Window(QMainWindow, Ui_MainWindow): # Update intro counter if applicable and, if updated, return # because playing an intro takes precedence over timing a # preview. - if ( - self.music.is_playing() - and track_sequence.now.intro - ): - + if self.music.is_playing() and track_sequence.now.intro: remaining_ms = track_sequence.now.intro - self.music.get_playtime() if remaining_ms > 0: self.label_intro_timer.setText(f"{remaining_ms / 1000:.1f}") + if remaining_ms <= Config.INTRO_SECONDS_WARNING_MS: + self.label_intro_timer.setStyleSheet( + f"background: {Config.COLOUR_WARNING_TIMER}" + ) return + else: + self.label_intro_timer.setStyleSheet("") # Ensure preview button is reset if preview finishes playing self.btnPreview.setChecked(self.preview_player.is_playing())