From 652f10fc4c312a51162d3d369fff73e6686e04c4 Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Sun, 1 Mar 2026 12:35:23 +0300 Subject: [PATCH] Reduce visualizer latency, tighten UI paddings, fix mobile browser toolbar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Visualizer: FPS 25→30, chunk_size 2048→1024, smoothing 0.65→0.15 - Beat effect: scale 0.03→0.04, glow range 0.5-0.8→0.4-0.8 - UI: reduce container/section paddings from 2rem to 1rem - Source name: add ellipsis overflow for long names - Mobile browser toolbar: use flex-wrap instead of column stack, hide "Items per page" label text on small screens Co-Authored-By: Claude Opus 4.6 --- media_server/config.py | 2 +- media_server/services/audio_analyzer.py | 4 +-- media_server/static/css/styles.css | 38 ++++++++++++++++++------- media_server/static/js/player.js | 6 ++-- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/media_server/config.py b/media_server/config.py index b9b797b..e2ba9eb 100644 --- a/media_server/config.py +++ b/media_server/config.py @@ -118,7 +118,7 @@ class Settings(BaseSettings): description="Enable audio spectrum visualizer (requires soundcard + numpy)", ) visualizer_fps: int = Field( - default=25, + default=30, description="Visualizer update rate in frames per second", ge=10, le=60, diff --git a/media_server/services/audio_analyzer.py b/media_server/services/audio_analyzer.py index f07f3cd..997351f 100644 --- a/media_server/services/audio_analyzer.py +++ b/media_server/services/audio_analyzer.py @@ -40,8 +40,8 @@ class AudioAnalyzer: self, num_bins: int = 32, sample_rate: int = 44100, - chunk_size: int = 2048, - target_fps: int = 25, + chunk_size: int = 1024, + target_fps: int = 30, device_name: str | None = None, ): self.num_bins = num_bins diff --git a/media_server/static/css/styles.css b/media_server/static/css/styles.css index 6dc878c..f5d291e 100644 --- a/media_server/static/css/styles.css +++ b/media_server/static/css/styles.css @@ -144,7 +144,7 @@ body.dialog-open { .container { max-width: 800px; margin: 0 auto; - padding: 2rem 2rem 0.5rem; + padding: 0.75rem 0.75rem 0.5rem; } header { @@ -498,7 +498,7 @@ h1 { .player-container { background: var(--bg-secondary); border-radius: 12px; - padding: 2rem; + padding: 1rem; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); } @@ -936,12 +936,18 @@ button:disabled { align-items: center; justify-content: center; gap: 0.75rem; + min-width: 0; } .source-label { display: inline-flex; align-items: center; gap: 0.35rem; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + max-width: 200px; } .source-icon { @@ -998,7 +1004,7 @@ button:disabled { .scripts-container { background: var(--bg-secondary); border-radius: 12px; - padding: 2rem; + padding: 1rem; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); } @@ -1131,7 +1137,7 @@ button:disabled { } .settings-section summary { - padding: 1rem 1.5rem; + padding: 1rem; font-size: 1rem; font-weight: 600; color: var(--text-primary); @@ -1169,7 +1175,7 @@ button:disabled { } .settings-section-content { - padding: 0 1.5rem 1.5rem; + padding: 0 1rem 1rem; overflow-x: auto; } @@ -1282,7 +1288,7 @@ button:disabled { .display-container { background: var(--bg-secondary); border-radius: 12px; - padding: 2rem; + padding: 1rem; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); } @@ -2218,7 +2224,7 @@ button.primary svg { @media (max-width: 600px) { .container { - padding: 1rem; + padding: 0.5rem; } #album-art { @@ -2289,7 +2295,7 @@ footer .separator { .browser-container { background: var(--bg-secondary); border-radius: 12px; - padding: 2rem; + padding: 1rem; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); } @@ -3006,16 +3012,26 @@ footer .separator { } .browser-toolbar { - flex-direction: column; - align-items: stretch; + flex-wrap: wrap; + gap: 0.5rem; + } + + .browser-toolbar-left { + gap: 0.35rem; } .browser-search-wrapper { max-width: none; + flex-basis: 100%; + order: 10; } .browser-toolbar-right { - justify-content: flex-end; + margin-left: auto; + } + + .items-per-page-label span { + display: none; } .browser-list-item { diff --git a/media_server/static/js/player.js b/media_server/static/js/player.js index b7ed756..d960cc4 100644 --- a/media_server/static/js/player.js +++ b/media_server/static/js/player.js @@ -258,7 +258,7 @@ let visualizerCtx = null; let visualizerAnimFrame = null; let frequencyData = null; let smoothedFrequencies = null; -const VISUALIZER_SMOOTHING = 0.65; +const VISUALIZER_SMOOTHING = 0.15; async function checkVisualizerAvailability() { try { @@ -386,7 +386,7 @@ function renderVisualizerFrame() { } const bass = frequencyData.bass || 0; - const scale = 1 + bass * 0.03; + const scale = 1 + bass * 0.04; const art = document.getElementById('album-art'); if (art) { if (vinylMode) { @@ -397,7 +397,7 @@ function renderVisualizerFrame() { } const glow = document.getElementById('album-art-glow'); if (glow) { - glow.style.opacity = (0.5 + bass * 0.3).toFixed(2); + glow.style.opacity = (0.4 + bass * 0.4).toFixed(2); } }