Add: showExtras optional parameter

pull/16/head
Juraj Nyíri 4 years ago
parent 40846d3a9d
commit 6f86fc68be

@ -59,7 +59,9 @@ _Available special libraries:_
**runAfter**: _Optional_ Specify a script to run after playing. **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: Example of card configuration:

@ -19918,6 +19918,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.detailsShown = false; this.detailsShown = false;
this.runBefore = ''; this.runBefore = '';
this.playTrailer = true; this.playTrailer = true;
this.showExtras = true;
this.runAfter = ''; this.runAfter = '';
this.columnsCount = 0; this.columnsCount = 0;
this.renderedItems = 0; this.renderedItems = 0;
@ -20811,7 +20812,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}, 200); }, 200);
} }
else { else {
const extras = dataDetails.Extras.Metadata;
this.episodesElemFreshlyLoaded = true; this.episodesElemFreshlyLoaded = true;
if (this.episodesElem) { if (this.episodesElem) {
this.episodesElemHidden = false; this.episodesElemHidden = false;
@ -20819,11 +20819,14 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.episodesElem.innerHTML = ''; this.episodesElem.innerHTML = '';
this.episodesElem.style.transition = `0s`; this.episodesElem.style.transition = `0s`;
this.episodesElem.style.top = `${top + 2000}px`; this.episodesElem.style.top = `${top + 2000}px`;
lodash.forEach(extras, extrasData => { if (this.showExtras) {
if (this.episodesElem && this.playController) { const extras = dataDetails.Extras.Metadata;
this.episodesElem.append(createEpisodesView(this.playController, this.plexProtocol, this.config.ip, this.config.port, this.config.token, extrasData)); 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); clearInterval(this.episodesLoadTimeout);
this.episodesLoadTimeout = setTimeout(() => { this.episodesLoadTimeout = setTimeout(() => {
if (this.episodesElem) { if (this.episodesElem) {
@ -21053,6 +21056,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (!lodash.isNil(config.playTrailer)) { if (!lodash.isNil(config.playTrailer)) {
this.playTrailer = 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.plex = new Plex(this.config.ip, this.config.port, this.config.token, this.plexProtocol, this.config.sort);
}; };
this.getCardSize = () => { this.getCardSize = () => {

@ -27,6 +27,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
playTrailer: string | boolean = true; playTrailer: string | boolean = true;
showExtras = true;
runAfter = ''; runAfter = '';
renderNewElementsIfNeededTimeout: any; renderNewElementsIfNeededTimeout: any;
@ -1088,8 +1090,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} }
}, 200); }, 200);
} else { } else {
const extras = dataDetails.Extras.Metadata;
this.episodesElemFreshlyLoaded = true; this.episodesElemFreshlyLoaded = true;
if (this.episodesElem) { if (this.episodesElem) {
this.episodesElemHidden = false; this.episodesElemHidden = false;
@ -1098,20 +1098,23 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.episodesElem.style.transition = `0s`; this.episodesElem.style.transition = `0s`;
this.episodesElem.style.top = `${top + 2000}px`; this.episodesElem.style.top = `${top + 2000}px`;
_.forEach(extras, extrasData => { if (this.showExtras) {
if (this.episodesElem && this.playController) { const extras = dataDetails.Extras.Metadata;
this.episodesElem.append( _.forEach(extras, extrasData => {
createEpisodesView( if (this.episodesElem && this.playController) {
this.playController, this.episodesElem.append(
this.plexProtocol, createEpisodesView(
this.config.ip, this.playController,
this.config.port, this.plexProtocol,
this.config.token, this.config.ip,
extrasData this.config.port,
) this.config.token,
); extrasData
} )
}); );
}
});
}
clearInterval(this.episodesLoadTimeout); clearInterval(this.episodesLoadTimeout);
this.episodesLoadTimeout = setTimeout(() => { this.episodesLoadTimeout = setTimeout(() => {
@ -1367,6 +1370,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (!_.isNil(config.playTrailer)) { if (!_.isNil(config.playTrailer)) {
this.playTrailer = 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); this.plex = new Plex(this.config.ip, this.config.port, this.config.token, this.plexProtocol, this.config.sort);
}; };

Loading…
Cancel
Save