diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 23dc673..e62db63 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -20426,9 +20426,15 @@ class PlexMeetsHomeAssistant extends HTMLElement { }, 200); } if (this.plex) { - if (data.childCount > 0) { + let seasonsData = {}; + if (lodash.isEqual(data.type, 'episode')) { + seasonsData = await this.plex.getLibraryData(data.grandparentKey.split('/')[3]); + } + else if (data.childCount > 0) { + seasonsData = await this.plex.getLibraryData(data.key.split('/')[3]); + } + if (!lodash.isEmpty(seasonsData)) { this.seasonElemFreshlyLoaded = true; - const seasonsData = await this.plex.getLibraryData(data.key.split('/')[3]); if (this.seasonsElem) { this.seasonsElem.style.display = 'block'; this.seasonsElem.innerHTML = ''; diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index 7925cfd..cdc1120 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -745,9 +745,14 @@ class PlexMeetsHomeAssistant extends HTMLElement { }, 200); } if (this.plex) { - if (data.childCount > 0) { + let seasonsData: Record = {}; + if (_.isEqual(data.type, 'episode')) { + seasonsData = await this.plex.getLibraryData(data.grandparentKey.split('/')[3]); + } else if (data.childCount > 0) { + seasonsData = await this.plex.getLibraryData(data.key.split('/')[3]); + } + if (!_.isEmpty(seasonsData)) { this.seasonElemFreshlyLoaded = true; - const seasonsData = await this.plex.getLibraryData(data.key.split('/')[3]); if (this.seasonsElem) { this.seasonsElem.style.display = 'block'; this.seasonsElem.innerHTML = '';