Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add START env var to get custom channel numbers #27

Merged
merged 1 commit into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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