diff --git a/README.md b/README.md index 18675d7..1fdde32 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,9 @@ _Available special libraries:_ **runAfter**: _Optional_ Specify a script to run after playing. -**playTrailer**: _Optional_ Specify whether to play trailer if available. Possible values: true, false, muted +**showExtras**: _Optional_ Specify whether to show extras if any available on movie / episode. Possible values: true, false. Default: true + +**playTrailer**: _Optional_ Specify whether to play trailer if available. Possible values: true, false, muted. Default: true Example of card configuration: diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 197fc94..79c73a1 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -19918,6 +19918,7 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.detailsShown = false; this.runBefore = ''; this.playTrailer = true; + this.showExtras = true; this.runAfter = ''; this.columnsCount = 0; this.renderedItems = 0; @@ -20811,7 +20812,6 @@ class PlexMeetsHomeAssistant extends HTMLElement { }, 200); } else { - const extras = dataDetails.Extras.Metadata; this.episodesElemFreshlyLoaded = true; if (this.episodesElem) { this.episodesElemHidden = false; @@ -20819,11 +20819,14 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.episodesElem.innerHTML = ''; this.episodesElem.style.transition = `0s`; this.episodesElem.style.top = `${top + 2000}px`; - lodash.forEach(extras, extrasData => { - if (this.episodesElem && this.playController) { - this.episodesElem.append(createEpisodesView(this.playController, this.plexProtocol, this.config.ip, this.config.port, this.config.token, extrasData)); - } - }); + if (this.showExtras) { + const extras = dataDetails.Extras.Metadata; + lodash.forEach(extras, extrasData => { + if (this.episodesElem && this.playController) { + this.episodesElem.append(createEpisodesView(this.playController, this.plexProtocol, this.config.ip, this.config.port, this.config.token, extrasData)); + } + }); + } clearInterval(this.episodesLoadTimeout); this.episodesLoadTimeout = setTimeout(() => { if (this.episodesElem) { @@ -21053,6 +21056,9 @@ class PlexMeetsHomeAssistant extends HTMLElement { if (!lodash.isNil(config.playTrailer)) { this.playTrailer = config.playTrailer; } + if (!lodash.isNil(config.showExtras)) { + this.showExtras = config.showExtras; + } this.plex = new Plex(this.config.ip, this.config.port, this.config.token, this.plexProtocol, this.config.sort); }; this.getCardSize = () => { diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index f0819fe..b6e61b0 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -27,6 +27,8 @@ class PlexMeetsHomeAssistant extends HTMLElement { playTrailer: string | boolean = true; + showExtras = true; + runAfter = ''; renderNewElementsIfNeededTimeout: any; @@ -1088,8 +1090,6 @@ class PlexMeetsHomeAssistant extends HTMLElement { } }, 200); } else { - const extras = dataDetails.Extras.Metadata; - this.episodesElemFreshlyLoaded = true; if (this.episodesElem) { this.episodesElemHidden = false; @@ -1098,20 +1098,23 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.episodesElem.style.transition = `0s`; this.episodesElem.style.top = `${top + 2000}px`; - _.forEach(extras, extrasData => { - if (this.episodesElem && this.playController) { - this.episodesElem.append( - createEpisodesView( - this.playController, - this.plexProtocol, - this.config.ip, - this.config.port, - this.config.token, - extrasData - ) - ); - } - }); + if (this.showExtras) { + const extras = dataDetails.Extras.Metadata; + _.forEach(extras, extrasData => { + if (this.episodesElem && this.playController) { + this.episodesElem.append( + createEpisodesView( + this.playController, + this.plexProtocol, + this.config.ip, + this.config.port, + this.config.token, + extrasData + ) + ); + } + }); + } clearInterval(this.episodesLoadTimeout); this.episodesLoadTimeout = setTimeout(() => { @@ -1367,6 +1370,9 @@ class PlexMeetsHomeAssistant extends HTMLElement { if (!_.isNil(config.playTrailer)) { this.playTrailer = config.playTrailer; } + if (!_.isNil(config.showExtras)) { + this.showExtras = config.showExtras; + } this.plex = new Plex(this.config.ip, this.config.port, this.config.token, this.plexProtocol, this.config.sort); };