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.
**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:

@ -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`;
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 = () => {

@ -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,6 +1098,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.episodesElem.style.transition = `0s`;
this.episodesElem.style.top = `${top + 2000}px`;
if (this.showExtras) {
const extras = dataDetails.Extras.Metadata;
_.forEach(extras, extrasData => {
if (this.episodesElem && this.playController) {
this.episodesElem.append(
@ -1112,6 +1114,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
);
}
});
}
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);
};

Loading…
Cancel
Save