From 27d99e614512c4c45fc794dbbe12e1b79ffd6b77 Mon Sep 17 00:00:00 2001 From: Aman Karmani Date: Tue, 19 Oct 2021 13:49:06 -0700 Subject: [PATCH] avoid injecting episode ids for movies; skip unavailable descriptions and genres --- PlutoIPTV/index.js | 63 +++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/PlutoIPTV/index.js b/PlutoIPTV/index.js index 10196b8..2af42ed 100755 --- a/PlutoIPTV/index.js +++ b/PlutoIPTV/index.js @@ -456,11 +456,6 @@ ${m3uUrl} children: [ { name: "title", attrs: { lang: "en" }, text: programme.title }, { name: "icon", attrs: { src: airingArt } }, - { - name: "desc", - attrs: { lang: "en" }, - text: programme.episode.description, - }, { name: "date", text: moment( @@ -474,31 +469,11 @@ ${m3uUrl} attrs: { lang: "en" }, text: isMovie ? "Movie" : "Series", }, - { - name: "category", - attrs: { lang: "en" }, - text: programme.episode.genre, - }, - { - name: "category", - attrs: { lang: "en" }, - text: programme.episode.subGenre, - }, { name: "series-id", attrs: { system: "pluto" }, text: programme.episode.series._id, }, - { - name: "episode-num", - attrs: { system: "onscreen" }, - text: episodeNumberString || programme.episode.number, - }, - { - name: "episode-num", - attrs: { system: "pluto" }, - text: programme.episode._id, - }, { name: "episode-num", attrs: { system: "original-air-date" }, @@ -509,11 +484,47 @@ ${m3uUrl} ], }; + if (programme.episode.description && programme.episode.description != "No information available") { + airing.children.push({ + name: "desc", + attrs: { lang: "en" }, + text: programme.episode.description, + }) + } + if (programme.episode.genre && programme.episode.genre != "No information available") { + airing.children.push({ + name: "category", + attrs: { lang: "en" }, + text: programme.episode.genre, + }) + } + if (programme.episode.subGenre && programme.episode.subGenre != "No information available") { + airing.children.push({ + name: "category", + attrs: { lang: "en" }, + text: programme.episode.subGenre, + }) + } + if (episodeNumberString || (programme.episode.number && programme.episode.number > 0 && !isMovie)) { + airing.children.push({ + name: "episode-num", + attrs: { system: "onscreen" }, + text: episodeNumberString || programme.episode.number, + }) + } + if (!isMovie) { + airing.children.push({ + name: "episode-num", + attrs: { system: "pluto" }, + text: programme.episode._id, + }) + } + let uniqueGenres = channelsGenres.filter(function (item, pos) { return channelsGenres.indexOf(item) == pos; }); - uniqueGenres.forEach((genre) => { + uniqueGenres.forEach(genre => { airing.children.push({ name: "category", attrs: { lang: "en" },