More cleanup

pull/40/head
Juraj Nyíri 3 years ago
parent 02a2342710
commit 736fa3e413

@ -19407,7 +19407,7 @@ class PlayController {
} }
switch (entity.key) { switch (entity.key) {
case 'kodi': case 'kodi':
await this.playViaKodi(entity.value, data, processData.type); await this.playViaKodi(entity.value, data, data.type);
break; break;
case 'androidtv': case 'androidtv':
if (!lodash.isNil(data.epg)) { if (!lodash.isNil(data.epg)) {
@ -19553,9 +19553,9 @@ class PlayController {
} }
}; };
this.playViaKodi = async (entityName, data, type) => { this.playViaKodi = async (entityName, data, type) => {
if (!lodash.isNil(lodash.get(data, 'epg.Media[0].channelCallSign'))) { if (type === 'epg') {
try { try {
const kodiData = await this.getKodiSearch(lodash.get(data, 'epg.Media[0].channelCallSign'), true); const kodiData = await this.getKodiSearch(lodash.get(data, 'channelCallSign'), true);
await this.hass.callService('kodi', 'call_method', { await this.hass.callService('kodi', 'call_method', {
// eslint-disable-next-line @typescript-eslint/camelcase // eslint-disable-next-line @typescript-eslint/camelcase
entity_id: entityName, entity_id: entityName,
@ -21452,6 +21452,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
const liveTV = await this.plex.getLiveTV(); const liveTV = await this.plex.getLiveTV();
lodash.forEach(liveTV, (data, key) => { lodash.forEach(liveTV, (data, key) => {
this.data[key] = data; this.data[key] = data;
lodash.forEach(this.data[key], (value, innerKey) => {
this.data[key][innerKey].type = 'epg';
});
}); });
} }
}; };
@ -21491,7 +21494,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
lodash.forEach(this.data[key], (libraryData, libraryKey) => { lodash.forEach(this.data[key], (libraryData, libraryKey) => {
if (!lodash.isNil(this.epgData[key][libraryData.channelCallSign])) { if (!lodash.isNil(this.epgData[key][libraryData.channelCallSign])) {
this.data[key][libraryKey].epg = this.epgData[key][libraryData.channelCallSign]; this.data[key][libraryKey].epg = this.epgData[key][libraryData.channelCallSign];
this.data[key][libraryKey].type = 'epg';
} }
}); });
}); });

@ -126,7 +126,7 @@ class PlayController {
} }
switch (entity.key) { switch (entity.key) {
case 'kodi': case 'kodi':
await this.playViaKodi(entity.value, data, processData.type); await this.playViaKodi(entity.value, data, data.type);
break; break;
case 'androidtv': case 'androidtv':
if (!_.isNil(data.epg)) { if (!_.isNil(data.epg)) {
@ -283,9 +283,9 @@ class PlayController {
}; };
private playViaKodi = async (entityName: string, data: Record<string, any>, type: string): Promise<void> => { private playViaKodi = async (entityName: string, data: Record<string, any>, type: string): Promise<void> => {
if (!_.isNil(_.get(data, 'epg.Media[0].channelCallSign'))) { if (type === 'epg') {
try { try {
const kodiData = await this.getKodiSearch(_.get(data, 'epg.Media[0].channelCallSign'), true); const kodiData = await this.getKodiSearch(_.get(data, 'channelCallSign'), true);
await this.hass.callService('kodi', 'call_method', { await this.hass.callService('kodi', 'call_method', {
// eslint-disable-next-line @typescript-eslint/camelcase // eslint-disable-next-line @typescript-eslint/camelcase

@ -410,6 +410,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
const liveTV = await this.plex.getLiveTV(); const liveTV = await this.plex.getLiveTV();
_.forEach(liveTV, (data, key) => { _.forEach(liveTV, (data, key) => {
this.data[key] = data; this.data[key] = data;
_.forEach(this.data[key], (value, innerKey) => {
this.data[key][innerKey].type = 'epg';
});
}); });
} }
}; };
@ -450,7 +453,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
_.forEach(this.data[key], (libraryData, libraryKey) => { _.forEach(this.data[key], (libraryData, libraryKey) => {
if (!_.isNil(this.epgData[key][libraryData.channelCallSign])) { if (!_.isNil(this.epgData[key][libraryData.channelCallSign])) {
this.data[key][libraryKey].epg = this.epgData[key][libraryData.channelCallSign]; this.data[key][libraryKey].epg = this.epgData[key][libraryData.channelCallSign];
this.data[key][libraryKey].type = 'epg';
} }
}); });
}); });

Loading…
Cancel
Save