From 2288e32b1c8453a2c35f4bfe3eec8de117547626 Mon Sep 17 00:00:00 2001 From: Eric Lindvall Date: Sat, 27 Aug 2022 20:55:36 -0700 Subject: [PATCH 1/2] Adding EXCLUDE_CATEGORIES environment variable --- PlutoIPTV/index.js | 14 +++++++++++--- README.md | 5 +++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/PlutoIPTV/index.js b/PlutoIPTV/index.js index b5df898..2b378d5 100755 --- a/PlutoIPTV/index.js +++ b/PlutoIPTV/index.js @@ -221,6 +221,11 @@ if (process.argv[2]) { versions = versions.concat(process.argv[2].split(",")); } +let excludedCategories = [] +if (process.env.EXCLUDE_CATEGORIES) { + excludedCategories = process.env.EXCLUDE_CATEGORIES.split(",") +} + const plutoIPTV = { grabJSON: function (callback) { callback = callback || function () {}; @@ -330,7 +335,10 @@ function processChannels(version, list) { channels.forEach((channel) => { let deviceId = uuid1(); let sid = uuid4(); - if ( + + if (excludedCategories.includes(channel.category)) { + console.log(`[DEBUG] Skipping channel ${channel.name} from excluded category '${channel.category}'`); + } else if ( channel.isStitched && !channel.slug.match(/^announcement|^privacy-policy/) ) { @@ -380,9 +388,9 @@ function processChannels(version, list) { ${m3uUrl} `; - console.log("[INFO] Adding " + channel.name + " channel."); + console.log("[INFO] Adding " + channel.name + " channel"); } else { - console.log("[DEBUG] Skipping 'fake' channel " + channel.name + "."); + console.log("[DEBUG] Skipping 'fake' channel " + channel.name); } }); diff --git a/README.md b/README.md index ad7af97..1c7eca9 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,11 @@ Simpley provide a comma separated list of words without spaces with the `VERSION docker run -d --restart unless-stopped --name pluto-for-channels -p 8080:80 -e VERSIONS=Dad,Bob,Joe jonmaddox/pluto-for-channels +### Optionally exclude channel categories + +By using the `EXCLUDE_CATEGORIES` environment variable when starting the docker container, +you can tell it to exclude channel categories from the .m3u + ## Add Source to Channels From 0cd88ccddff7dbec46457f3d760872d831bb2b3c Mon Sep 17 00:00:00 2001 From: Eric Lindvall Date: Sat, 27 Aug 2022 21:41:35 -0700 Subject: [PATCH 2/2] Add examples --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 1c7eca9..f2527e3 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,14 @@ Simpley provide a comma separated list of words without spaces with the `VERSION By using the `EXCLUDE_CATEGORIES` environment variable when starting the docker container, you can tell it to exclude channel categories from the .m3u +Provide a comma separated list of categories: + + EXCLUDE_CATEGORIES=Kids,En Español,Music,Gaming + Anime + +If running via docker on the command line: + + docker run -d --restart unless-stopped --name pluto-for-channels -p 8080:80 -e "EXCLUDE_CATEGORIES=Kids,En Español,Music,Gaming + Anime" jonmaddox/pluto-for-channels + ## Add Source to Channels