mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 21:33:00 +00:00
logging for signifcant change tracking
This commit is contained in:
@@ -50,6 +50,7 @@ class MusicManager:
|
|||||||
self.title_scroll_tick = 0
|
self.title_scroll_tick = 0
|
||||||
self.artist_scroll_tick = 0
|
self.artist_scroll_tick = 0
|
||||||
self.is_music_display_active = False # New state variable
|
self.is_music_display_active = False # New state variable
|
||||||
|
self.is_currently_showing_nothing_playing = False # To prevent flashing
|
||||||
|
|
||||||
self._load_config() # Load config first
|
self._load_config() # Load config first
|
||||||
self._initialize_clients() # Initialize based on loaded config
|
self._initialize_clients() # Initialize based on loaded config
|
||||||
@@ -452,19 +453,22 @@ class MusicManager:
|
|||||||
logger.info("Music Screen (MusicManager): Nothing playing or info explicitly 'Nothing Playing'.")
|
logger.info("Music Screen (MusicManager): Nothing playing or info explicitly 'Nothing Playing'.")
|
||||||
self._last_nothing_playing_log_time = time.time()
|
self._last_nothing_playing_log_time = time.time()
|
||||||
|
|
||||||
if not force_clear:
|
# Only redraw "Nothing Playing" if we weren't already showing it or if force_clear is true
|
||||||
self.display_manager.clear()
|
if not self.is_currently_showing_nothing_playing or force_clear:
|
||||||
logger.debug("[MusicManager.display] Display cleared (not force_clear path).")
|
if force_clear or not self.is_currently_showing_nothing_playing: # Ensure clear if forced or first time
|
||||||
|
self.display_manager.clear()
|
||||||
|
logger.debug("[MusicManager.display] Display cleared for 'Nothing Playing'.")
|
||||||
|
|
||||||
logger.debug(f"[MusicManager.display] Font for 'Nothing Playing': {self.display_manager.regular_font}, Type: {type(self.display_manager.regular_font)}")
|
logger.debug(f"[MusicManager.display] Font for 'Nothing Playing': {self.display_manager.regular_font}, Type: {type(self.display_manager.regular_font)}")
|
||||||
text_width = self.display_manager.get_text_width("Nothing Playing", self.display_manager.regular_font)
|
text_width = self.display_manager.get_text_width("Nothing Playing", self.display_manager.regular_font)
|
||||||
logger.debug(f"[MusicManager.display] Calculated text_width for 'Nothing Playing': {text_width}")
|
logger.debug(f"[MusicManager.display] Calculated text_width for 'Nothing Playing': {text_width}")
|
||||||
x_pos = (self.display_manager.matrix.width - text_width) // 2
|
x_pos = (self.display_manager.matrix.width - text_width) // 2
|
||||||
y_pos = (self.display_manager.matrix.height // 2) - 4
|
y_pos = (self.display_manager.matrix.height // 2) - 4
|
||||||
logger.debug(f"[MusicManager.display] Drawing 'Nothing Playing' at x={x_pos}, y={y_pos}")
|
logger.debug(f"[MusicManager.display] Drawing 'Nothing Playing' at x={x_pos}, y={y_pos}")
|
||||||
self.display_manager.draw_text("Nothing Playing", x=x_pos, y=y_pos, font=self.display_manager.regular_font)
|
self.display_manager.draw_text("Nothing Playing", x=x_pos, y=y_pos, font=self.display_manager.regular_font)
|
||||||
self.display_manager.update_display()
|
self.display_manager.update_display()
|
||||||
logger.debug("[MusicManager.display] 'Nothing Playing' text drawn and display updated.")
|
logger.debug("[MusicManager.display] 'Nothing Playing' text drawn and display updated.")
|
||||||
|
self.is_currently_showing_nothing_playing = True
|
||||||
|
|
||||||
with self.track_info_lock: # Protect writes to shared state
|
with self.track_info_lock: # Protect writes to shared state
|
||||||
self.scroll_position_title = 0
|
self.scroll_position_title = 0
|
||||||
@@ -475,8 +479,9 @@ class MusicManager:
|
|||||||
# self.last_album_art_url = None # Keep last_album_art_url so we don't re-fetch if it was a brief flicker
|
# self.last_album_art_url = None # Keep last_album_art_url so we don't re-fetch if it was a brief flicker
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.debug("[MusicManager.display] Proceeding to display actual music info.")
|
|
||||||
# If we've reached here, it means we are about to display actual music info.
|
# If we've reached here, it means we are about to display actual music info.
|
||||||
|
self.is_currently_showing_nothing_playing = False # Reset flag
|
||||||
|
logger.debug("[MusicManager.display] Proceeding to display actual music info.")
|
||||||
if not self.is_music_display_active:
|
if not self.is_music_display_active:
|
||||||
self.activate_music_display()
|
self.activate_music_display()
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ class YTMClient:
|
|||||||
}
|
}
|
||||||
|
|
||||||
significant_change_detected = False
|
significant_change_detected = False
|
||||||
|
if current_key_data:
|
||||||
|
logging.debug(f"[YTMClient Check] Current Key Data: {current_key_data}")
|
||||||
|
logging.debug(f"[YTMClient Check] Last Processed Key Data: {self.last_processed_key_data}")
|
||||||
if current_key_data and (self.last_processed_key_data != current_key_data):
|
if current_key_data and (self.last_processed_key_data != current_key_data):
|
||||||
significant_change_detected = True
|
significant_change_detected = True
|
||||||
self.last_processed_key_data = current_key_data # Update only on significant change
|
self.last_processed_key_data = current_key_data # Update only on significant change
|
||||||
|
|||||||
Reference in New Issue
Block a user