Extract config into .env; add deploy.sh with overlay guard + rollback
- Move user-specific config (login, media roots, port, AP ssid/psk, service
user) into a gitignored .env; add .env.example template.
- config.py reads .env at startup via a tiny zero-dependency parser (works for
both `uv run` and systemd), and fails loudly if required vars are unset.
- load_secret_key falls back to an ephemeral key on a read-only filesystem
instead of crashing.
- systemd units become .template files; deploy.sh renders them with the
.env-derived user/paths.
- deploy.sh: refuses to run on a read-only overlay, git pull --ff-only,
uv sync, ensure secret key, re-apply the AP from .env, install units,
restart, health-check with automatic rollback to the previous commit.
- Scrub literal credentials/ssid out of the README; document .env + deploy.sh.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 02:06:47 +00:00
|
|
|
# Copy this file to .env and fill in real values.
|
|
|
|
|
# .env is gitignored -- never commit real secrets.
|
|
|
|
|
# Values must be simple (no spaces / shell-special chars) -- this file is both
|
|
|
|
|
# parsed by the app and sourced by deploy.sh.
|
|
|
|
|
|
|
|
|
|
# --- App login (custom login form) ---
|
|
|
|
|
MEDIAPI_USERNAME=changeme
|
|
|
|
|
MEDIAPI_PASSWORD=changeme
|
|
|
|
|
|
|
|
|
|
# --- Media ---
|
|
|
|
|
# colon-separated list of directories to browse
|
|
|
|
|
MEDIAPI_MEDIA_ROOTS=/localmedia
|
|
|
|
|
MEDIAPI_PORT=8080
|
|
|
|
|
|
Replace mpv with Kodi as the player; mediapi drives it over JSON-RPC
Playback moves to Kodi (standalone on GBM/KMS -- the smooth, hardware-decoded
LibreELEC path). mediapi becomes a thin remote: it browses media and controls
Kodi over its JSON-RPC HTTP API. This drops every mpv/DRM/X-mirror problem
(DRM-master exclusivity, gpu-next "export failed" wedges, X-mirror A/V desync,
software-decode choppiness) -- none of which had a working single config.
- new mediapi/kodi.py (stdlib JSON-RPC client); player.py rewritten to poll
and drive Kodi (Player.Open/PlayPause/Seek, Application.SetVolume,
Player.GetProperties), same public interface + keep-playing auto-advance
- config.py: KODI_* settings replace MPV_SOCKET; __init__ + api_routes updated
- delete mpv_ipc.py, the mpv/X units, start-mpv/session scripts
- new systemd/mediapi-kodi.service.template (standalone Kodi on tty1) +
scripts/configure-kodi.py (headlessly enable Kodi's JSON-RPC web server)
- install.sh now bootstraps a BARE Pi OS Lite end to end: apt base packages,
installs uv, installs Kodi, enables its web API, configures the AP, installs
+ starts services (only git need be preinstalled). Auto-seeds .env from the
example on first run.
- README + .env.example updated for the Kodi architecture
Dual HDMI is handled in hardware (external splitter off one port); no software
mirror -- see git history for why that can't work smoothly on this Pi.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 02:42:04 +00:00
|
|
|
# --- Kodi (the actual player) ---
|
|
|
|
|
# mediapi drives Kodi over its JSON-RPC HTTP endpoint. install.sh installs Kodi,
|
|
|
|
|
# starts it on KMS, and enables its web server with these credentials/port.
|
|
|
|
|
# Keep the port different from MEDIAPI_PORT above.
|
|
|
|
|
MEDIAPI_KODI_HOST=127.0.0.1
|
|
|
|
|
MEDIAPI_KODI_PORT=8090
|
|
|
|
|
MEDIAPI_KODI_USER=kodi
|
|
|
|
|
MEDIAPI_KODI_PASSWORD=changeme
|
2026-07-08 23:09:08 +00:00
|
|
|
# Kodi audio output. Default routes to the Pi's first HDMI port (Kodi otherwise
|
|
|
|
|
# picks the analog jack). Override for the 2nd HDMI port (vc4hdmi1) if needed.
|
|
|
|
|
#MEDIAPI_KODI_AUDIO_DEVICE=ALSA:hdmi:CARD=vc4hdmi0,DEV=0|vc4-hdmi-0
|
Replace mpv with Kodi as the player; mediapi drives it over JSON-RPC
Playback moves to Kodi (standalone on GBM/KMS -- the smooth, hardware-decoded
LibreELEC path). mediapi becomes a thin remote: it browses media and controls
Kodi over its JSON-RPC HTTP API. This drops every mpv/DRM/X-mirror problem
(DRM-master exclusivity, gpu-next "export failed" wedges, X-mirror A/V desync,
software-decode choppiness) -- none of which had a working single config.
- new mediapi/kodi.py (stdlib JSON-RPC client); player.py rewritten to poll
and drive Kodi (Player.Open/PlayPause/Seek, Application.SetVolume,
Player.GetProperties), same public interface + keep-playing auto-advance
- config.py: KODI_* settings replace MPV_SOCKET; __init__ + api_routes updated
- delete mpv_ipc.py, the mpv/X units, start-mpv/session scripts
- new systemd/mediapi-kodi.service.template (standalone Kodi on tty1) +
scripts/configure-kodi.py (headlessly enable Kodi's JSON-RPC web server)
- install.sh now bootstraps a BARE Pi OS Lite end to end: apt base packages,
installs uv, installs Kodi, enables its web API, configures the AP, installs
+ starts services (only git need be preinstalled). Auto-seeds .env from the
example on first run.
- README + .env.example updated for the Kodi architecture
Dual HDMI is handled in hardware (external splitter off one port); no software
mirror -- see git history for why that can't work smoothly on this Pi.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 02:42:04 +00:00
|
|
|
|
2026-07-07 01:21:17 +00:00
|
|
|
# --- System: the Linux user the systemd services run as ---
|
|
|
|
|
# Auto-detected from whoever runs install.sh (id -un) when left unset, so you
|
|
|
|
|
# normally don't need this. Uncomment only to force a specific user.
|
|
|
|
|
#MEDIAPI_USER=pi
|
Extract config into .env; add deploy.sh with overlay guard + rollback
- Move user-specific config (login, media roots, port, AP ssid/psk, service
user) into a gitignored .env; add .env.example template.
- config.py reads .env at startup via a tiny zero-dependency parser (works for
both `uv run` and systemd), and fails loudly if required vars are unset.
- load_secret_key falls back to an ephemeral key on a read-only filesystem
instead of crashing.
- systemd units become .template files; deploy.sh renders them with the
.env-derived user/paths.
- deploy.sh: refuses to run on a read-only overlay, git pull --ff-only,
uv sync, ensure secret key, re-apply the AP from .env, install units,
restart, health-check with automatic rollback to the previous commit.
- Scrub literal credentials/ssid out of the README; document .env + deploy.sh.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 02:06:47 +00:00
|
|
|
|
2026-07-07 00:33:46 +00:00
|
|
|
# --- WiFi access point (re-applied by install.sh) ---
|
Extract config into .env; add deploy.sh with overlay guard + rollback
- Move user-specific config (login, media roots, port, AP ssid/psk, service
user) into a gitignored .env; add .env.example template.
- config.py reads .env at startup via a tiny zero-dependency parser (works for
both `uv run` and systemd), and fails loudly if required vars are unset.
- load_secret_key falls back to an ephemeral key on a read-only filesystem
instead of crashing.
- systemd units become .template files; deploy.sh renders them with the
.env-derived user/paths.
- deploy.sh: refuses to run on a read-only overlay, git pull --ff-only,
uv sync, ensure secret key, re-apply the AP from .env, install units,
restart, health-check with automatic rollback to the previous commit.
- Scrub literal credentials/ssid out of the README; document .env + deploy.sh.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 02:06:47 +00:00
|
|
|
MEDIAPI_WIFI_COUNTRY=US
|
|
|
|
|
MEDIAPI_AP_SSID=changeme
|
|
|
|
|
MEDIAPI_AP_PASSWORD=changeme
|
|
|
|
|
MEDIAPI_AP_CONN_NAME=mediapi-ap
|
2026-07-07 00:33:46 +00:00
|
|
|
|