Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions plugins.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "1.0.0",
"last_updated": "2026-02-26",
"last_updated": "2026-03-01",
"plugins": [
{
"id": "hello-world",
Expand Down Expand Up @@ -150,10 +150,10 @@
"plugin_path": "plugins/ledmatrix-music",
"stars": 0,
"downloads": 0,
"last_updated": "2025-11-05",
"last_updated": "2026-03-01",
"verified": true,
"screenshot": "",
"latest_version": "1.0.3"
"latest_version": "1.0.4"
},
{
"id": "calendar",
Expand Down
43 changes: 35 additions & 8 deletions plugins/ledmatrix-music/config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
"title_text": {
"type": "object",
"title": "Track Title",
"description": "Font settings for the track title",
"description": "Font and layout settings for the track title",
"properties": {
"font": {
"type": "string",
Expand All @@ -207,20 +207,29 @@
"minimum": 4,
"maximum": 16,
"default": 8
},
"y_percent": {
"type": "number",
"title": "Vertical Position",
"description": "Vertical position as fraction of display height (0.0=top, 1.0=bottom). Adjust if elements overlap the progress bar.",
"minimum": 0.0,
"maximum": 1.0,
"default": 0.03,
"multipleOf": 0.01
}
},
"x-propertyOrder": ["font", "font_size"],
"x-propertyOrder": ["font", "font_size", "y_percent"],
"additionalProperties": false
},
"artist_text": {
"type": "object",
"title": "Artist Name",
"description": "Font settings for the artist name",
"description": "Font and layout settings for the artist name",
"properties": {
"font": {
"type": "string",
"title": "Font Family",
"description": "Select the font to use",
"description": "Select the font to use (default matches the display manager 5x7 font)",
"enum": [
"PressStart2P-Regular.ttf",
"4x6-font.ttf",
Expand All @@ -238,20 +247,29 @@
"minimum": 4,
"maximum": 16,
"default": 7
},
"y_percent": {
"type": "number",
"title": "Vertical Position",
"description": "Vertical position as fraction of display height (0.0=top, 1.0=bottom). Adjust if elements overlap the progress bar.",
"minimum": 0.0,
"maximum": 1.0,
"default": 0.34,
"multipleOf": 0.01
}
},
"x-propertyOrder": ["font", "font_size"],
"x-propertyOrder": ["font", "font_size", "y_percent"],
"additionalProperties": false
},
"album_text": {
"type": "object",
"title": "Album Name",
"description": "Font settings for the album name",
"description": "Font and layout settings for the album name",
"properties": {
"font": {
"type": "string",
"title": "Font Family",
"description": "Select the font to use",
"description": "Select the font to use (default matches the display manager 5x7 font)",
"enum": [
"PressStart2P-Regular.ttf",
"4x6-font.ttf",
Expand All @@ -269,9 +287,18 @@
"minimum": 4,
"maximum": 16,
"default": 7
},
"y_percent": {
"type": "number",
"title": "Vertical Position",
"description": "Vertical position as fraction of display height (0.0=top, 1.0=bottom). Adjust if elements overlap the progress bar.",
"minimum": 0.0,
"maximum": 1.0,
"default": 0.60,
"multipleOf": 0.01
}
},
"x-propertyOrder": ["font", "font_size"],
"x-propertyOrder": ["font", "font_size", "y_percent"],
"additionalProperties": false
}
},
Expand Down
36 changes: 27 additions & 9 deletions plugins/ledmatrix-music/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,13 +950,26 @@ def display(self, force_clear: bool = False) -> None:
font_artist = self.artist_font if self.artist_font else self.display_manager.bdf_5x7_font
font_album = self.album_font if self.album_font else self.display_manager.bdf_5x7_font

# Read per-element layout overrides from customization config.
customization_layout = self.config.get('customization', {})
title_layout_config = customization_layout.get('title_text', {})
artist_layout_config = customization_layout.get('artist_text', {})
album_layout_config = customization_layout.get('album_text', {})

def _safe_y_percent(value, fallback):
"""Normalize optional y_percent values to 0.0-1.0 range."""
try:
return max(0.0, min(1.0, float(value)))
except (TypeError, ValueError):
return fallback

title_y_percent = _safe_y_percent(title_layout_config.get('y_percent', 0.03), 0.03)
artist_y_percent = _safe_y_percent(artist_layout_config.get('y_percent', 0.34), 0.34)
album_y_percent = _safe_y_percent(album_layout_config.get('y_percent', 0.60), 0.60)

# Calculate y positions as percentages of display height for scaling
matrix_height = self.display_manager.matrix.height

# Define positions as percentages (0.0 to 1.0) - these scale with display size
ARTIST_Y_PERCENT = 0.34 # 34% from top
ALBUM_Y_PERCENT = 0.60 # 60% from top


# Calculate dynamic font heights based on display size
# For smaller displays (32px), use smaller line heights
# For larger displays, scale up proportionally
Expand All @@ -972,12 +985,17 @@ def display(self, force_clear: bool = False) -> None:
FIXED_BDF_BASELINE_SHIFT = max(6, int(matrix_height * 0.19)) # 19% of height, min 6

# Calculate positions with proper scaling
y_pos_title_top = max(1, int(matrix_height * 0.03)) # 3% from top, min 1px
y_pos_artist_top = int(matrix_height * ARTIST_Y_PERCENT) + FIXED_BDF_BASELINE_SHIFT
y_pos_album_top = int(matrix_height * ALBUM_Y_PERCENT) + FIXED_BDF_BASELINE_SHIFT
y_pos_title_top = max(1, int(matrix_height * title_y_percent))
y_pos_artist_top = int(matrix_height * artist_y_percent) + FIXED_BDF_BASELINE_SHIFT
y_pos_album_top = int(matrix_height * album_y_percent) + FIXED_BDF_BASELINE_SHIFT

# Debug logging for scaling calculations
self.logger.debug(f"MusicPlugin.display: Display scaling - matrix: {matrix_width}x{matrix_height}, album_art: {album_art_size}px, LINE_HEIGHT_BDF: {LINE_HEIGHT_BDF}, positions - title: {y_pos_title_top}, artist: {y_pos_artist_top}, album: {y_pos_album_top}")
self.logger.debug(
f"MusicPlugin.display: Display scaling - matrix: {matrix_width}x{matrix_height}, "
f"album_art: {album_art_size}px, LINE_HEIGHT_BDF: {LINE_HEIGHT_BDF}, "
f"y_percent(title/artist/album)=({title_y_percent:.2f}/{artist_y_percent:.2f}/{album_y_percent:.2f}), "
f"positions - title: {y_pos_title_top}, artist: {y_pos_artist_top}, album: {y_pos_album_top}"
)

# Title scrolling with configurable settings
title_config = self.scroll_config['title']
Expand Down
9 changes: 7 additions & 2 deletions plugins/ledmatrix-music/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "ledmatrix-music",
"name": "Music Player - Now Playing",
"version": "1.0.3",
"version": "1.0.4",
"description": "Real-time now playing display for Spotify and YouTube Music with album art, scrolling text, and progress bars",
"author": "ChuckBuilds",
"entry_point": "manager.py",
Expand Down Expand Up @@ -67,6 +67,11 @@
}
],
"versions": [
{
"version": "1.0.4",
"ledmatrix_min": "2.0.0",
"released": "2026-03-01"
},
{
"version": "1.0.3",
"ledmatrix_min": "2.0.0",
Expand All @@ -78,7 +83,7 @@
"released": "2025-01-16"
}
],
"last_updated": "2025-11-05",
"last_updated": "2026-03-01",
"stars": 0,
"downloads": 0,
"verified": true,
Expand Down