2.0
Juraj Nyíri 3 years ago
parent bede6f2c57
commit 46221d02a7

@ -19594,14 +19594,9 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.appendChild(this.content); this.appendChild(this.content);
// todo: do verify better, do not query plex every time // todo: do verify better, do not query plex every time
this.sections = []; this.sections = [];
if (this.plex) { console.log(this.plexPort);
try { this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort);
this.sections = await this.plex.getSections(); this.sections = await this.plex.getSections();
}
catch (err) {
// pass
}
}
this.plexValidSection.style.display = 'none'; this.plexValidSection.style.display = 'none';
this.plexValidSection.innerHTML = ''; this.plexValidSection.innerHTML = '';
const viewTitle = document.createElement('h2'); const viewTitle = document.createElement('h2');
@ -19707,9 +19702,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
}; };
this.setConfig = (config) => { this.setConfig = (config) => {
this.config = JSON.parse(JSON.stringify(config)); this.config = JSON.parse(JSON.stringify(config));
if (config.port) { if (config.port && !lodash.isEqual(config.port, '')) {
this.plexPort = config.port; this.plexPort = config.port;
} }
else {
this.plexPort = false;
}
if (config.protocol) { if (config.protocol) {
this.plexProtocol = config.protocol; this.plexProtocol = config.protocol;
} }
@ -19719,7 +19717,6 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
if (!config.sort) { if (!config.sort) {
this.config.sort = 'titleSort:asc'; this.config.sort = 'titleSort:asc';
} }
this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort);
this.render(); this.render();
}; };
this.configChanged = (newConfig) => { this.configChanged = (newConfig) => {
@ -21746,9 +21743,12 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (config.protocol) { if (config.protocol) {
this.plexProtocol = config.protocol; this.plexProtocol = config.protocol;
} }
if (config.port) { if (config.port && !lodash.isEqual(config.port, '')) {
this.plexPort = config.port; this.plexPort = config.port;
} }
else {
this.plexPort = false;
}
if (config.maxCount && config.maxCount !== '') { if (config.maxCount && config.maxCount !== '') {
this.maxCount = config.maxCount; this.maxCount = config.maxCount;
} }

@ -197,13 +197,10 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
// todo: do verify better, do not query plex every time // todo: do verify better, do not query plex every time
this.sections = []; this.sections = [];
if (this.plex) {
try { console.log(this.plexPort);
this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort);
this.sections = await this.plex.getSections(); this.sections = await this.plex.getSections();
} catch (err) {
// pass
}
}
this.plexValidSection.style.display = 'none'; this.plexValidSection.style.display = 'none';
this.plexValidSection.innerHTML = ''; this.plexValidSection.innerHTML = '';
@ -316,8 +313,10 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
setConfig = (config: Record<string, any>): void => { setConfig = (config: Record<string, any>): void => {
this.config = JSON.parse(JSON.stringify(config)); this.config = JSON.parse(JSON.stringify(config));
if (config.port) { if (config.port && !_.isEqual(config.port, '')) {
this.plexPort = config.port; this.plexPort = config.port;
} else {
this.plexPort = false;
} }
if (config.protocol) { if (config.protocol) {
@ -330,7 +329,6 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.config.sort = 'titleSort:asc'; this.config.sort = 'titleSort:asc';
} }
this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort);
this.render(); this.render();
}; };

@ -1526,8 +1526,10 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (config.protocol) { if (config.protocol) {
this.plexProtocol = config.protocol; this.plexProtocol = config.protocol;
} }
if (config.port) { if (config.port && !_.isEqual(config.port, '')) {
this.plexPort = config.port; this.plexPort = config.port;
} else {
this.plexPort = false;
} }
if (config.maxCount && config.maxCount !== '') { if (config.maxCount && config.maxCount !== '') {
this.maxCount = config.maxCount; this.maxCount = config.maxCount;

Loading…
Cancel
Save