From 707ee0a4e4e06976c6258f1bd195697566a24cf0 Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Mon, 14 Nov 2022 11:27:58 -0500 Subject: [PATCH] support a START env var that allows namespacing and custom channel numbers that preserve channel order --- PlutoIPTV/index.js | 4 +++- README.md | 15 +++++++++++++-- entrypoint.sh | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/PlutoIPTV/index.js b/PlutoIPTV/index.js index b5df898..32fabe2 100755 --- a/PlutoIPTV/index.js +++ b/PlutoIPTV/index.js @@ -216,6 +216,7 @@ const seriesGenres = [ ]; versions = ["main"]; +start = parseInt(process.env.START || 0); if (process.argv[2]) { versions = versions.concat(process.argv[2].split(",")); @@ -373,10 +374,11 @@ function processChannels(version, list) { .replace(/(\r\n|\n|\r)/gm, " ") .replace('"', "") .replace("”", ""); + let channelNumber = start + parseInt(channel.number); m3u8 = m3u8 + - `#EXTINF:0 channel-id="${slug}" channel-number="${channel.number}" tvg-logo="${logo}" tvc-guide-art="${art}" tvc-guide-title="${name}" tvc-guide-description="${guideDescription}" group-title="${group}", ${name} + `#EXTINF:0 channel-id="${slug}" channel-number="${channelNumber}" tvg-logo="${logo}" tvc-guide-art="${art}" tvc-guide-title="${name}" tvc-guide-description="${guideDescription}" group-title="${group}", ${name} ${m3uUrl} `; diff --git a/README.md b/README.md index ad7af97..82e9b9a 100644 --- a/README.md +++ b/README.md @@ -15,15 +15,26 @@ Running the container is easy. Fire up the container as usual. You can set which You can retrieve the playlist and EPG via the status page. http://127.0.0.1:8080 - + ### Optionally have multiple feeds generated By using the `VERSIONS` env var when starting the docker container, you can tell it to create multiple feeds that can be used elsewhere. -Simpley provide a comma separated list of words without spaces with the `VERSIONS` env var. +Simply provide a comma separated list of words without spaces with the `VERSIONS` env var. docker run -d --restart unless-stopped --name pluto-for-channels -p 8080:80 -e VERSIONS=Dad,Bob,Joe jonmaddox/pluto-for-channels +### Optionally provide a starting channel number + +By using the `START` env var when starting the docker container, you can tell it to start channel numbers with this value. Original Pluto channel numbers will be added to this, keeping all of the channels in the same order they are on Pluto. + +You should use a starting number greater than 10000, so that the channel numbers will be preserved but not conflict with any other channels you may have. + +For example, channel 345 will be 10345. Channel 2102 will be 12102. + +Simpley provide a starting number with the `START` env var. + + docker run -d --restart unless-stopped --name pluto-for-channels -p 8080:80 -e START=80000 jonmaddox/pluto-for-channels ## Add Source to Channels diff --git a/entrypoint.sh b/entrypoint.sh index 13d9667..91cb895 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -14,7 +14,7 @@ get_latest_release() { while : do - node index.js $VERSIONS + START=$START node index.js $VERSIONS CURRENT_VERSION=`cat VERSION` LATEST_VERSION=`get_latest_release`