From c6bcdedef75f90badb20916813aa295302e70d7d Mon Sep 17 00:00:00 2001 From: Lyncoln Date: Thu, 10 Sep 2026 10:01:34 -0400 Subject: [PATCH] Make HTTP port configurable with default 1876 --- Containerfile | 4 ++-- README.md | 11 ++++++++--- entrypoint.sh | 6 +++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Containerfile b/Containerfile index a3daed9..cdf2243 100644 --- a/Containerfile +++ b/Containerfile @@ -5,8 +5,8 @@ COPY epg ./epg COPY tvj_epj.py . RUN pip install --no-cache-dir requests -ENV UPDATE_INTERVAL=6 -EXPOSE 8787 +ENV UPDATE_INTERVAL=6 PORT=1876 +EXPOSE 1876 COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md index 41f9ef1..7f2b922 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Build this checkout and select both channels: ```sh podman build -t tvj-epg . -podman run -d --name tvj-epg -p 8787:8787 \ +podman run -d --name tvj-epg -p 1876:1876 \ -e TZ=America/Jamaica \ -e CHANNELS=tvj,tvjsn \ -e UPDATE_INTERVAL=3 \ @@ -20,8 +20,12 @@ podman run -d --name tvj-epg -p 8787:8787 \ With no `CHANNELS` setting, only TVJ is included, preserving the default behavior. Use `CHANNELS=tvjsn` for TVJ Sports Network alone. -- Playlist: `http://localhost:8787/tvj.m3u` -- Guide: `http://localhost:8787/tvj.xml` +- Playlist: `http://localhost:1876/tvj.m3u` +- Guide: `http://localhost:1876/tvj.xml` + +To use a different port, set `PORT` and match the container port in the mapping, +for example `-e PORT=8787 -p 8787:8787`. Recreating an existing container requires +updating its port mapping for the new default. Both files contain the selected channels. Their XMLTV IDs and playlist `tvg-id` values match automatically. Outputs become available after the first successful @@ -31,6 +35,7 @@ update. Stream access is determined by the stream provider. | Variable | Default | Meaning | | --- | --- | --- | +| `PORT` | `1876` | HTTP listening port (1–65535) | | `CHANNELS` | `tvj` | Comma-separated built-in channel keys; unknown keys fail startup | | `UPDATE_INTERVAL` | `6` | Positive integer refresh interval in hours | | `TZ` | Container timezone | Logging timezone; XMLTV timestamps remain UTC | diff --git a/entrypoint.sh b/entrypoint.sh index 187d384..4148895 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,10 @@ #!/bin/sh set -eu +PORT="${PORT-1876}" +export PORT +PORT="$(python -c 'import os; value = os.environ["PORT"]; valid = value.isascii() and value.isdigit() and 1 <= int(value) <= 65535; valid or exit("PORT must be an integer from 1 to 65535"); print(int(value))')" + mkdir -p /app/output UPDATE_INTERVAL="${UPDATE_INTERVAL:-6}" export UPDATE_INTERVAL @@ -18,4 +22,4 @@ python -c 'from epg.config import load; load()' ) & cd /app/output -exec python3 -m http.server 8787 +exec python3 -m http.server "$PORT"