Add: Live tv into editor UI

live_tv
Juraj Nyíri 3 years ago
parent fa37fbda00
commit 4dda13c2dc

@ -19646,6 +19646,7 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.entitiesRegistry = false;
this.plexValidSection = document.createElement('div');
this.loaded = false;
this.livetv = {};
this.fireEvent = (node, type, detail, options = {}) => {
// eslint-disable-next-line no-param-reassign
detail = detail === null || detail === undefined ? {} : detail;
@ -19859,6 +19860,7 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.appendChild(this.content);
this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort);
this.sections = await this.plex.getSections();
this.livetv = await this.plex.getLiveTV();
this.collections = await this.plex.getCollections();
this.playlists = await this.plex.getPlaylists();
this.clients = await this.plex.getClients();
@ -20068,6 +20070,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.runAfter.addEventListener('value-changed', this.valueUpdated);
this.runAfter.value = this.config.runAfter;
this.plexValidSection.appendChild(this.runAfter);
if (!lodash.isEmpty(this.livetv)) {
libraryItems.appendChild(addDropdownItem('Live TV', true));
lodash.forEach(lodash.keys(this.livetv), (livetv) => {
libraryItems.appendChild(addDropdownItem(livetv));
});
}
if (!lodash.isEmpty(this.sections)) {
libraryItems.appendChild(addDropdownItem('Libraries', true));
lodash.forEach(this.sections, (section) => {

@ -72,6 +72,8 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
loaded = false;
livetv: Record<string, any> = {};
fireEvent = (
node: HTMLElement,
type: string,
@ -300,6 +302,7 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort);
this.sections = await this.plex.getSections();
this.livetv = await this.plex.getLiveTV();
this.collections = await this.plex.getCollections();
this.playlists = await this.plex.getPlaylists();
this.clients = await this.plex.getClients();
@ -519,6 +522,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.runAfter.value = this.config.runAfter;
this.plexValidSection.appendChild(this.runAfter);
if (!_.isEmpty(this.livetv)) {
libraryItems.appendChild(addDropdownItem('Live TV', true));
_.forEach(_.keys(this.livetv), (livetv: string) => {
libraryItems.appendChild(addDropdownItem(livetv));
});
}
if (!_.isEmpty(this.sections)) {
libraryItems.appendChild(addDropdownItem('Libraries', true));
_.forEach(this.sections, (section: Record<string, any>) => {

Loading…
Cancel
Save