31807f37bf
Repo hygiene: - Remove dead scripts (.wait-for-display, .display-keepalive, .keep-screen-alive) - Remove stale backup/scratch (install.sh.bak, New.txt, stale .pyc) - Stop tracking machine-specific/generated state (config/app_config.json, playlists/server_playlist.json, src/player_auth.json, generated launchers) - Prune duplicate wheel versions (one per package) - Reorganize working_files -> dev/, dev/tests/, documentation/dev-notes/, scripts/ - Extend .gitignore; fix no-op rules in repo/.gitignore Offline install (install.sh): - Non-fatal system-dep step; per-package apt retry; .deb bundle install - Skip pip self-upgrade offline; guard online fallbacks behind connectivity probe - Dependency-free fetch_url (curl/wget/urllib); --no-reboot flag - Fix corrupted literal backslash-bang escapes (shebangs, test -f, banner) - Idempotent cron install (no more stacked @reboot lines) Autostart / watchdog: - start.sh: single-instance flock lock (.player_watchdog.lock) acquired only after a display is confirmed, preventing parallel watchdogs - Set XDG_RUNTIME_DIR when missing; exit early if headless - run_player.sh: activate .venv; stop_player.sh: clear lock file
56 lines
1.5 KiB
Python
56 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Direct API test to check server playlist."""
|
|
|
|
import requests
|
|
import json
|
|
|
|
# Try with the saved auth
|
|
auth_file = 'src/player_auth.json'
|
|
with open(auth_file, 'r') as f:
|
|
auth_data = json.load(f)
|
|
|
|
server_url = auth_data['server_url']
|
|
auth_code = auth_data['auth_code']
|
|
|
|
print("=" * 80)
|
|
print("DIRECT API TEST")
|
|
print("=" * 80)
|
|
print(f"Server: {server_url}")
|
|
print(f"Auth code: {auth_code[:20]}...")
|
|
print()
|
|
|
|
# Try to get playlist
|
|
try:
|
|
url = f"{server_url}/api/player/playlist"
|
|
headers = {
|
|
'Authorization': f'Bearer {auth_code}'
|
|
}
|
|
|
|
print(f"Fetching: {url}")
|
|
response = requests.get(url, headers=headers, timeout=10)
|
|
|
|
print(f"Status: {response.status_code}")
|
|
|
|
if response.status_code == 200:
|
|
data = response.json()
|
|
print(f"\nPlaylist version: {data.get('playlist_version', 'N/A')}")
|
|
print(f"Number of items: {len(data.get('playlist', []))}")
|
|
|
|
print("\nPlaylist items:")
|
|
for idx, item in enumerate(data.get('playlist', []), 1):
|
|
print(f"\n {idx}. {item.get('file_name', 'N/A')}")
|
|
print(f" URL: {item.get('url', 'N/A')}")
|
|
print(f" Duration: {item.get('duration', 'N/A')}s")
|
|
|
|
# Save full response
|
|
with open('server_playlist_full.json', 'w') as f:
|
|
json.dump(data, f, indent=2)
|
|
print(f"\nFull response saved to: server_playlist_full.json")
|
|
else:
|
|
print(f"Error: {response.text}")
|
|
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
|
|
print("\n" + "=" * 80)
|