From ed78a2ce84ebd33b9dde6fd6ae2577ba1061f0d5 Mon Sep 17 00:00:00 2001 From: CasperMcFadden95 <145611964+CasperMcFadden95@users.noreply.github.com> Date: Sun, 28 Sep 2025 09:09:03 +0000 Subject: [PATCH] Add image, genre and fix season --- sites/shahid.mbc.net/shahid.mbc.net.config.js | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/sites/shahid.mbc.net/shahid.mbc.net.config.js b/sites/shahid.mbc.net/shahid.mbc.net.config.js index 599af98c..de562b36 100644 --- a/sites/shahid.mbc.net/shahid.mbc.net.config.js +++ b/sites/shahid.mbc.net/shahid.mbc.net.config.js @@ -22,8 +22,10 @@ module.exports = { return { title: item.title, description: item.description, - session: item.seasonNumber, + image: parseImage(item), + season: item.seasonNumber, episode: item.episodeNumber, + category: item.genres, start: dayjs.tz(item.actualFrom, 'UTC').toISOString(), stop: dayjs.tz(item.actualTo, 'UTC').toISOString() } @@ -81,3 +83,22 @@ function parseItems(content, channel) { return items } + +function parseImage(item) { + // image may have params such as width that needs to be substituted or removed for it load + return removeParameters(item.productPoster) +} + +function removeParameters(url) { + if (url) { + try { + const urlObj = new URL(url) + urlObj.search = '' + urlObj.hash = '' + return urlObj.toString() + } catch { + return null + } + } + return url +}