From 765039e778735bde327c3035c12f2fecb8d7c624 Mon Sep 17 00:00:00 2001 From: unkn <1+unkn@noreply.localhost> Date: Mon, 28 Sep 2026 13:03:12 +0100 Subject: [PATCH] Update dashboard.py Tidied the dashboard by adding a user drop down menu rather than having all users displayed on a single page --- dashboard.py | 87 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 74 insertions(+), 13 deletions(-) diff --git a/dashboard.py b/dashboard.py index 4b46f5c..9f5ad09 100644 --- a/dashboard.py +++ b/dashboard.py @@ -1,11 +1,9 @@ -import os import sqlite3 from datetime import datetime import traceback -# Configurable paths via environment variables with fallback defaults -DB_PATH = os.getenv('NAVIDROME_DB_PATH', './navidrome.db') -OUTPUT_HTML = os.getenv('OUTPUT_HTML_PATH', './public/index.html') +DB_PATH = '/nddata/navidrome.db' +OUTPUT_HTML = '/app/public/index.html' def get_all_users(): try: @@ -56,9 +54,17 @@ def generate_html(): Music Listening Dashboard - All-Time Top Tracks -

All-Time Top Tracks & History

+
+

All-Time Top Tracks & History

+
+
+ + +
+ +
+
+
""" - for user in users: + for i, user in enumerate(users): print(f"Processing scrobbles for {user}...") rows = get_aggregated_scrobbles(user) + active_class = " active" if i == 0 else "" html_content += f""" -
+

{user}

Unique tracks played: {len(rows)}
@@ -102,15 +127,51 @@ def generate_html(): html_content += """ + + """ print(f"Writing HTML to {OUTPUT_HTML}...") - os.makedirs(os.path.dirname(OUTPUT_HTML), exist_ok=True) with open(OUTPUT_HTML, 'w') as f: f.write(html_content) - print("Dashboard HTML generated successfully for all users.") + print("Dashboard HTML generated successfully.") if __name__ == '__main__': try: