|
|
@ -20983,6 +20983,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
this.searchInputElem = document.createElement('input');
|
|
|
|
this.searchInputElem = document.createElement('input');
|
|
|
|
this.plexProtocol = 'http';
|
|
|
|
this.plexProtocol = 'http';
|
|
|
|
this.plexPort = false;
|
|
|
|
this.plexPort = false;
|
|
|
|
|
|
|
|
this.epgData = {};
|
|
|
|
this.detailsShown = false;
|
|
|
|
this.detailsShown = false;
|
|
|
|
this.entityRegistry = [];
|
|
|
|
this.entityRegistry = [];
|
|
|
|
this.runBefore = '';
|
|
|
|
this.runBefore = '';
|
|
|
@ -21260,12 +21261,16 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
const getLiveTV = async () => {
|
|
|
|
const getLiveTV = async () => {
|
|
|
|
if (this.plex) {
|
|
|
|
if (this.plex) {
|
|
|
|
const liveTV = await this.plex.getLiveTV();
|
|
|
|
const liveTV = await this.plex.getLiveTV();
|
|
|
|
console.log(await this.plex.getEPG());
|
|
|
|
|
|
|
|
lodash.forEach(liveTV, (data, key) => {
|
|
|
|
lodash.forEach(liveTV, (data, key) => {
|
|
|
|
this.data[key] = data;
|
|
|
|
this.data[key] = data;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const getEPG = async () => {
|
|
|
|
|
|
|
|
if (this.plex) {
|
|
|
|
|
|
|
|
this.epgData = await this.plex.getEPG();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
let sectionKey = 0;
|
|
|
|
let sectionKey = 0;
|
|
|
|
lodash.forEach(plexAllSections, (section) => {
|
|
|
|
lodash.forEach(plexAllSections, (section) => {
|
|
|
|
if (lodash.isEqual(section.title, this.config.libraryName)) {
|
|
|
|
if (lodash.isEqual(section.title, this.config.libraryName)) {
|
|
|
@ -21291,7 +21296,15 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
loadDataRequests.push(getRecentyAdded());
|
|
|
|
loadDataRequests.push(getRecentyAdded());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
loadDataRequests.push(getLiveTV());
|
|
|
|
loadDataRequests.push(getLiveTV());
|
|
|
|
|
|
|
|
loadDataRequests.push(getEPG());
|
|
|
|
const [plexSections] = await Promise.all(loadDataRequests);
|
|
|
|
const [plexSections] = await Promise.all(loadDataRequests);
|
|
|
|
|
|
|
|
lodash.forEach(this.epgData, (value, key) => {
|
|
|
|
|
|
|
|
lodash.forEach(this.data[key], (libraryData, libraryKey) => {
|
|
|
|
|
|
|
|
if (!lodash.isNil(this.epgData[key][libraryData.channelCallSign])) {
|
|
|
|
|
|
|
|
this.data[key][libraryKey].epg = this.epgData[key][libraryData.channelCallSign];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
if (plexSections && sectionKey) {
|
|
|
|
if (plexSections && sectionKey) {
|
|
|
|
lodash.forEach(plexSections, section => {
|
|
|
|
lodash.forEach(plexSections, section => {
|
|
|
|
this.data[section.title1] = section.Metadata;
|
|
|
|
this.data[section.title1] = section.Metadata;
|
|
|
@ -21905,7 +21918,15 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
this.getElementsByClassName('detailsTitle')[0].innerHTML = escapeHtml(mainData.title);
|
|
|
|
this.getElementsByClassName('detailsTitle')[0].innerHTML = escapeHtml(mainData.title);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!lodash.isNil(mainData.year)) {
|
|
|
|
this.getElementsByClassName('detailsYear')[0].innerHTML = escapeHtml(mainData.year);
|
|
|
|
this.getElementsByClassName('detailsYear')[0].innerHTML = escapeHtml(mainData.year);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (!lodash.isNil(mainData.epg) && !lodash.isNil(mainData.epg.title)) {
|
|
|
|
|
|
|
|
this.getElementsByClassName('detailsYear')[0].innerHTML = escapeHtml(mainData.epg.title);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
this.getElementsByClassName('detailsYear')[0].innerHTML = '';
|
|
|
|
|
|
|
|
}
|
|
|
|
this.getElementsByClassName('metaInfo')[0].innerHTML = `${(mainData.duration !== undefined
|
|
|
|
this.getElementsByClassName('metaInfo')[0].innerHTML = `${(mainData.duration !== undefined
|
|
|
|
? `<span class='minutesDetail'>${Math.round(parseInt(escapeHtml(mainData.duration), 10) / 60 / 1000)} min</span>`
|
|
|
|
? `<span class='minutesDetail'>${Math.round(parseInt(escapeHtml(mainData.duration), 10) / 60 / 1000)} min</span>`
|
|
|
|
: '') +
|
|
|
|
: '') +
|
|
|
@ -21915,7 +21936,15 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
(mainData.rating !== undefined
|
|
|
|
(mainData.rating !== undefined
|
|
|
|
? `<span class='ratingDetail'>${mainData.rating < 5 ? '🗑' : '⭐'} ${Math.round(parseFloat(escapeHtml(mainData.rating)) * 10) / 10}</span>`
|
|
|
|
? `<span class='ratingDetail'>${mainData.rating < 5 ? '🗑' : '⭐'} ${Math.round(parseFloat(escapeHtml(mainData.rating)) * 10) / 10}</span>`
|
|
|
|
: '')}<div class='clear'></div>`;
|
|
|
|
: '')}<div class='clear'></div>`;
|
|
|
|
|
|
|
|
if (!lodash.isNil(mainData.summary)) {
|
|
|
|
this.getElementsByClassName('detailDesc')[0].innerHTML = escapeHtml(mainData.summary);
|
|
|
|
this.getElementsByClassName('detailDesc')[0].innerHTML = escapeHtml(mainData.summary);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (!lodash.isNil(mainData.epg) && !lodash.isNil(mainData.epg.summary)) {
|
|
|
|
|
|
|
|
this.getElementsByClassName('detailDesc')[0].innerHTML = escapeHtml(mainData.epg.summary);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
this.getElementsByClassName('detailDesc')[0].innerHTML = '';
|
|
|
|
|
|
|
|
}
|
|
|
|
/* todo temp disabled
|
|
|
|
/* todo temp disabled
|
|
|
|
if (data.type === 'movie') {
|
|
|
|
if (data.type === 'movie') {
|
|
|
|
(this.detailElem.children[5] as HTMLElement).style.visibility = 'visible';
|
|
|
|
(this.detailElem.children[5] as HTMLElement).style.visibility = 'visible';
|
|
|
@ -22411,9 +22440,12 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
if (lodash.isEqual(data.type, 'episode')) {
|
|
|
|
if (lodash.isEqual(data.type, 'episode')) {
|
|
|
|
yearElem.innerHTML = escapeHtml(data.title);
|
|
|
|
yearElem.innerHTML = escapeHtml(data.title);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else if (!lodash.isNil(data.year)) {
|
|
|
|
yearElem.innerHTML = escapeHtml(data.year);
|
|
|
|
yearElem.innerHTML = escapeHtml(data.year);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (!lodash.isNil(data.epg)) {
|
|
|
|
|
|
|
|
yearElem.innerHTML = escapeHtml(data.epg.title);
|
|
|
|
|
|
|
|
}
|
|
|
|
yearElem.className = 'yearElem';
|
|
|
|
yearElem.className = 'yearElem';
|
|
|
|
const additionalElem = document.createElement('div');
|
|
|
|
const additionalElem = document.createElement('div');
|
|
|
|
if (lodash.isEqual(data.type, 'episode')) {
|
|
|
|
if (lodash.isEqual(data.type, 'episode')) {
|
|
|
|