|
|
@ -18674,6 +18674,8 @@ class Plex {
|
|
|
|
this.clients = [];
|
|
|
|
this.clients = [];
|
|
|
|
this.requestTimeout = 10000;
|
|
|
|
this.requestTimeout = 10000;
|
|
|
|
this.sections = [];
|
|
|
|
this.sections = [];
|
|
|
|
|
|
|
|
this.providers = [];
|
|
|
|
|
|
|
|
this.livetv = {};
|
|
|
|
this.collections = false;
|
|
|
|
this.collections = false;
|
|
|
|
this.playlists = [];
|
|
|
|
this.playlists = [];
|
|
|
|
this.init = async () => {
|
|
|
|
this.init = async () => {
|
|
|
@ -18692,6 +18694,39 @@ class Plex {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return this.clients;
|
|
|
|
return this.clients;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
this.getProviders = async () => {
|
|
|
|
|
|
|
|
if (lodash.isEmpty(this.providers)) {
|
|
|
|
|
|
|
|
const url = this.authorizeURL(`${this.getBasicURL()}/media/providers`);
|
|
|
|
|
|
|
|
const providersData = await axios.get(url, {
|
|
|
|
|
|
|
|
timeout: this.requestTimeout
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
this.providers = providersData.data.MediaContainer.MediaProvider;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.providers;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
this.getLiveTV = async () => {
|
|
|
|
|
|
|
|
if (lodash.isEmpty(this.livetv)) {
|
|
|
|
|
|
|
|
const returnData = {};
|
|
|
|
|
|
|
|
const providers = await this.getProviders();
|
|
|
|
|
|
|
|
const liveTVRequests = [];
|
|
|
|
|
|
|
|
const liveTVRequestsNames = [];
|
|
|
|
|
|
|
|
lodash.forEach(providers, provider => {
|
|
|
|
|
|
|
|
if (lodash.isEqual(provider.protocols, 'livetv')) {
|
|
|
|
|
|
|
|
const url = this.authorizeURL(`${this.getBasicURL()}/${provider.identifier}/tags?type=310`);
|
|
|
|
|
|
|
|
liveTVRequests.push(axios.get(url, {
|
|
|
|
|
|
|
|
timeout: this.requestTimeout
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
liveTVRequestsNames.push(provider.title);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
const allResults = await Promise.all(liveTVRequests);
|
|
|
|
|
|
|
|
lodash.forEach(allResults, (result, key) => {
|
|
|
|
|
|
|
|
returnData[liveTVRequestsNames[key]] = result.data.MediaContainer.Directory;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
this.livetv = returnData;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.livetv;
|
|
|
|
|
|
|
|
};
|
|
|
|
this.getServerID = async () => {
|
|
|
|
this.getServerID = async () => {
|
|
|
|
if (lodash.isEmpty(this.serverInfo)) {
|
|
|
|
if (lodash.isEmpty(this.serverInfo)) {
|
|
|
|
await this.getServerInfo();
|
|
|
|
await this.getServerInfo();
|
|
|
@ -21108,6 +21143,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await this.plex.init();
|
|
|
|
await this.plex.init();
|
|
|
|
const plexAllSections = await this.plex.getSections();
|
|
|
|
const plexAllSections = await this.plex.getSections();
|
|
|
|
|
|
|
|
console.log(await this.plex.getLiveTV());
|
|
|
|
const getOnDeck = async () => {
|
|
|
|
const getOnDeck = async () => {
|
|
|
|
if (this.plex) {
|
|
|
|
if (this.plex) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|