Skip to content

Commit

Permalink
support a START env var that allows namespacing and custom channel nu…
Browse files Browse the repository at this point in the history
…mbers that preserve channel order
  • Loading branch information
maddox committed Nov 14, 2022
1 parent 9a2b5cc commit 707ee0a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 3 additions & 1 deletion PlutoIPTV/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(","));
Expand Down Expand Up @@ -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}
`;
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 707ee0a

Please sign in to comment.