From c32457128500797635701ee647a8c2818082ea3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Sat, 10 Jul 2021 23:30:41 +0200 Subject: [PATCH] Fix: Opening season in recently added not loading episodes --- dist/plex-meets-homeassistant.js | 10 +++++++++- src/plex-meets-homeassistant.ts | 11 ++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index d4a2f41..426a35c 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -21202,7 +21202,15 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.episodesElem.innerHTML = ''; this.episodesElem.style.transition = `0s`; this.episodesElem.style.top = `${top + 2000}px`; - if (this.showExtras) { + if (lodash.isEqual(data.type, 'season')) { + const episodesData = await this.plex.getLibraryData(data.key.split('/')[3]); + lodash.forEach(episodesData, episodeData => { + if (this.episodesElem && this.playController && this.plex) { + this.episodesElem.append(createEpisodesView(this.playController, this.plex, episodeData)); + } + }); + } + else if (this.showExtras) { const extras = dataDetails.Extras.Metadata; lodash.forEach(extras, extrasData => { if (this.episodesElem && this.playController && this.plex) { diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index 44276e3..57eba07 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -1244,8 +1244,14 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.episodesElem.innerHTML = ''; this.episodesElem.style.transition = `0s`; this.episodesElem.style.top = `${top + 2000}px`; - - if (this.showExtras) { + if (_.isEqual(data.type, 'season')) { + const episodesData = await this.plex.getLibraryData(data.key.split('/')[3]); + _.forEach(episodesData, episodeData => { + if (this.episodesElem && this.playController && this.plex) { + this.episodesElem.append(createEpisodesView(this.playController, this.plex, episodeData)); + } + }); + } else if (this.showExtras) { const extras = dataDetails.Extras.Metadata; _.forEach(extras, extrasData => { if (this.episodesElem && this.playController && this.plex) { @@ -1253,7 +1259,6 @@ class PlexMeetsHomeAssistant extends HTMLElement { } }); } - clearInterval(this.episodesLoadTimeout); this.episodesLoadTimeout = setTimeout(() => { if (this.episodesElem) {