From 591269ae92db84216c81be24c92494a1c279ddd3 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Tue, 19 Sep 2023 09:03:58 -0700 Subject: [PATCH] fix: restore tv subtext --- src/_data/tv.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/_data/tv.js b/src/_data/tv.js index b0dac10e..e40b0dd2 100644 --- a/src/_data/tv.js +++ b/src/_data/tv.js @@ -30,14 +30,23 @@ module.exports = async function () { 1 ) + // populate the subtext to show the appropriate range if it spans multiple seasons + // this yields a string in the format of S1E1 - S2E2 or S1E1 - E2 + const subtext = + matchedEpisode['season'] === episode['episode']['season'] + ? `S${matchedEpisode['startingSeason'] || matchedEpisode['season']}E${ + matchedEpisode['startingEpisode'] || matchedEpisode['episode'] + } - E${episode['episode']['number']}` + : `S${matchedEpisode['startingSeason'] || matchedEpisode['season']}E${ + matchedEpisode['startingEpisode'] || matchedEpisode['episode'] + } - S${episode['episode']['season']}E${episode['episode']['number']}` + // push the new episode to the array episodes.push({ name: matchedEpisode['name'], title: matchedEpisode['title'], url: `https://trakt.tv/shows/${episode['show']['ids']['slug']}`, - subtext: `S${matchedEpisode['startingSeason'] || matchedEpisode['season']}E${ - matchedEpisode['startingEpisode'] || matchedEpisode['episode'] - } - S${episode['episode']['season']}E${episode['episode']['number']}`, + subtext, image: `https://cdn.coryd.dev/tv/${matchedEpisode['name'] .replace(':', '')