1
0

Env Vars & Geocode Data Caching

This commit is contained in:
2025-11-17 08:31:23 -05:00
parent 1f89e8d243
commit ef0ddbe778
5 changed files with 115 additions and 9 deletions

View File

@@ -20,6 +20,34 @@ docker-compose up
# ws4kp interface available at http://localhost:8080
```
### Environment Variables
Configure ports and services via environment variables:
```bash
# Default values
PORT=3000 # Main streaming server port
WS4KP_PORT=8080 # WS4KP weather service port
MUSIC_PATH=/music # Path to music files
# Example with custom ports
PORT=8000 WS4KP_PORT=9090 docker-compose up
```
Or use a `.env` file with docker-compose:
```env
PORT=8000
WS4KP_PORT=9090
```
### Persistent Geocoding Cache
Geocoding results are cached in the `./cache` directory. When using docker-compose, this directory is automatically mounted to persist between container restarts. If using Docker directly, mount the cache volume to persist data:
```bash
docker run -p 3000:3000 -p 8080:8080 -v $(pwd)/cache:/streaming-app/cache ghcr.io/sethwv/ws4kp-to-hls:latest
```
### Using Docker directly
```bash
@@ -72,7 +100,7 @@ http://localhost:3000/weather?city=Miami,FL,USA&width=1280&height=720&fps=25
http://localhost:3000/weather?city=Toronto,ON,Canada&hideLogo=true
```
**City Format**: Use `City,State,Country` format for best accuracy (e.g., `Toronto,ON,Canada` or `Miami,FL,USA`). The service automatically geocodes the city using OpenStreetMap's Nominatim API and falls back to Toronto coordinates if geocoding fails.
**City Format**: Use `City,State,Country` format for best accuracy (e.g., `Toronto,ON,Canada` or `Miami,FL,USA`). The service automatically geocodes the city using OpenStreetMap's Nominatim API and falls back to Toronto coordinates if geocoding fails. Geocoding results are cached in the `./cache` directory to improve performance and reduce API calls.
**Units**: Use `units=metric` (default) for Celsius/kph/km/mb or `units=imperial` for Fahrenheit/mph/miles/inHg.
@@ -146,4 +174,13 @@ ffmpeg -i "http://localhost:3000/stream?url=http://example.com" \
3. FFmpeg encodes the screenshots into an HLS stream (H.264 video, AAC audio for weather)
4. For weather streams: background music is shuffled and played from the Weatherscan collection
5. The HLS stream is piped directly to the HTTP response
6. City names are automatically geocoded to coordinates via OpenStreetMap's Nominatim API
6. City names are automatically geocoded to coordinates via OpenStreetMap's Nominatim API (results are cached locally for performance)
## Features
- **Configurable Ports**: Both streaming server and WS4KP service ports are configurable via environment variables
- **Geocoding Cache**: City geocoding results are cached on the filesystem to reduce API calls and improve response times
- **Background Music**: Weather streams include shuffled Weatherscan music collection
- **Multi-platform**: Docker images for AMD64 and ARM64 architectures
- **Automatic Geocoding**: City names are converted to coordinates automatically
- **Flexible Display Options**: Control which weather forecast sections to show/hide