added shutdown to actions tab, enabled some more displays, changed baseball to non-priority

This commit is contained in:
Chuck
2025-08-10 15:45:06 -05:00
parent 35dcf76689
commit 2bee99f9cc
3 changed files with 17 additions and 9 deletions

View File

@@ -317,7 +317,7 @@
}, },
"mlb": { "mlb": {
"enabled": true, "enabled": true,
"live_priority": true, "live_priority": false,
"live_game_duration": 30, "live_game_duration": 30,
"show_odds": true, "show_odds": true,
"test_mode": false, "test_mode": false,
@@ -412,13 +412,13 @@
} }
}, },
"music": { "music": {
"enabled": false, "enabled": true,
"preferred_source": "ytm", "preferred_source": "ytm",
"YTM_COMPANION_URL": "http://192.168.86.12:9863", "YTM_COMPANION_URL": "http://192.168.86.12:9863",
"POLLING_INTERVAL_SECONDS": 1 "POLLING_INTERVAL_SECONDS": 1
}, },
"of_the_day": { "of_the_day": {
"enabled": false, "enabled": true,
"display_rotate_interval": 20, "display_rotate_interval": 20,
"update_interval": 3600, "update_interval": 3600,
"subtitle_rotate_interval": 10, "subtitle_rotate_interval": 10,

View File

@@ -750,12 +750,6 @@
</div> </div>
</div> </div>
<div class="display-controls"> <div class="display-controls">
<button class="btn btn-success" onclick="startDisplay()">
<i class="fas fa-play"></i> Start Display
</button>
<button class="btn btn-danger" onclick="stopDisplay()">
<i class="fas fa-stop"></i> Stop Display
</button>
<button class="btn btn-warning" onclick="toggleEditorMode()"> <button class="btn btn-warning" onclick="toggleEditorMode()">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
{{ 'Exit Editor' if editor_mode else 'Enter Editor' }} {{ 'Exit Editor' if editor_mode else 'Enter Editor' }}
@@ -1684,6 +1678,9 @@
<button type="button" class="btn btn-danger" onclick="runAction('reboot_system')" onclick="return confirm('Are you sure you want to reboot?')"> <button type="button" class="btn btn-danger" onclick="runAction('reboot_system')" onclick="return confirm('Are you sure you want to reboot?')">
<i class="fas fa-power-off"></i> Reboot System <i class="fas fa-power-off"></i> Reboot System
</button> </button>
<button type="button" class="btn btn-danger" onclick="confirmShutdown()">
<i class="fas fa-power-off"></i> Shutdown System
</button>
</div> </div>
<h4>Action Output</h4> <h4>Action Output</h4>
@@ -2772,6 +2769,11 @@
} }
} }
function confirmShutdown(){
if (!confirm('Are you sure you want to shut down the system? This will power off the Raspberry Pi.')) return;
runAction('shutdown_system');
}
async function fetchLogs() { async function fetchLogs() {
const logContent = document.getElementById('log-content'); const logContent = document.getElementById('log-content');
logContent.textContent = 'Loading logs...'; logContent.textContent = 'Loading logs...';

View File

@@ -432,6 +432,9 @@ def system_action():
elif action == 'reboot_system': elif action == 'reboot_system':
result = subprocess.run(['sudo', '-n', 'reboot'], result = subprocess.run(['sudo', '-n', 'reboot'],
capture_output=True, text=True) capture_output=True, text=True)
elif action == 'shutdown_system':
result = subprocess.run(['sudo', '-n', 'poweroff'],
capture_output=True, text=True)
elif action == 'git_pull': elif action == 'git_pull':
# Run git pull from the repository directory where this file lives # Run git pull from the repository directory where this file lives
repo_dir = Path(__file__).resolve().parent repo_dir = Path(__file__).resolve().parent
@@ -601,6 +604,9 @@ def run_action_route():
elif action == 'reboot_system': elif action == 'reboot_system':
result = subprocess.run(['sudo', '-n', 'reboot'], result = subprocess.run(['sudo', '-n', 'reboot'],
capture_output=True, text=True) capture_output=True, text=True)
elif action == 'shutdown_system':
result = subprocess.run(['sudo', '-n', 'poweroff'],
capture_output=True, text=True)
elif action == 'git_pull': elif action == 'git_pull':
repo_dir = Path(__file__).resolve().parent repo_dir = Path(__file__).resolve().parent
if not (repo_dir / '.git').exists(): if not (repo_dir / '.git').exists():