|
|
@ -18943,6 +18943,7 @@ class Plex {
|
|
|
|
})).data.MediaContainer;
|
|
|
|
})).data.MediaContainer;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.tune = async (channelID, session) => {
|
|
|
|
this.tune = async (channelID, session) => {
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
session = 'PlexMeetsHomeAssistant3';
|
|
|
|
session = 'PlexMeetsHomeAssistant3';
|
|
|
|
console.log(channelID);
|
|
|
|
console.log(channelID);
|
|
|
|
// Todo: what is 12? do we need to get this from somewhere and change?
|
|
|
|
// Todo: what is 12? do we need to get this from somewhere and change?
|
|
|
@ -19427,7 +19428,7 @@ class PlayController {
|
|
|
|
const session = `PlexMeetsHomeAssistant-${Math.floor(Date.now() / 1000)}`;
|
|
|
|
const session = `PlexMeetsHomeAssistant-${Math.floor(Date.now() / 1000)}`;
|
|
|
|
const streamURL = await this.plex.tune(data.channelIdentifier, session);
|
|
|
|
const streamURL = await this.plex.tune(data.channelIdentifier, session);
|
|
|
|
console.log(`${this.plex.getBasicURL()}${streamURL}`);
|
|
|
|
console.log(`${this.plex.getBasicURL()}${streamURL}`);
|
|
|
|
this.playViaCast(entity.value, `${streamURL}`);
|
|
|
|
this.playViaCast(entity.value, `${streamURL}`, 'epg');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (this.hass.services.plex) {
|
|
|
|
else if (this.hass.services.plex) {
|
|
|
|
const libraryName = lodash.isNil(processData.librarySectionTitle)
|
|
|
|
const libraryName = lodash.isNil(processData.librarySectionTitle)
|
|
|
@ -19613,7 +19614,19 @@ class PlayController {
|
|
|
|
throw Error(`Plex type ${type} is not supported in Kodi.`);
|
|
|
|
throw Error(`Plex type ${type} is not supported in Kodi.`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.playViaCast = (entityName, mediaLink) => {
|
|
|
|
this.playViaCast = (entityName, mediaLink, contentType = 'video') => {
|
|
|
|
|
|
|
|
if (lodash.isEqual(contentType, 'video')) {
|
|
|
|
|
|
|
|
this.hass.callService('media_player', 'play_media', {
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
|
|
|
entity_id: entityName,
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
|
|
|
media_content_type: 'video',
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
|
|
|
media_content_id: this.plex.authorizeURL(`${this.plex.getBasicURL()}${mediaLink}`)
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (lodash.isEqual(contentType, 'epg')) {
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
mediaLink = this.plex.authorizeURL(`${this.plex.getBasicURL()}${mediaLink}`);
|
|
|
|
mediaLink = this.plex.authorizeURL(`${this.plex.getBasicURL()}${mediaLink}`);
|
|
|
|
const payload = {
|
|
|
|
const payload = {
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
@ -19639,6 +19652,7 @@ class PlayController {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
console.log(payload);
|
|
|
|
console.log(payload);
|
|
|
|
this.hass.callService('media_player', 'play_media', payload);
|
|
|
|
this.hass.callService('media_player', 'play_media', payload);
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.playViaCastPlex = (entityName, contentType, mediaLink) => {
|
|
|
|
this.playViaCastPlex = (entityName, contentType, mediaLink) => {
|
|
|
|
return this.hass.callService('media_player', 'play_media', {
|
|
|
|
return this.hass.callService('media_player', 'play_media', {
|
|
|
@ -19657,7 +19671,6 @@ class PlayController {
|
|
|
|
command += ' --ez "android.intent.extra.START_PLAYBACK" true';
|
|
|
|
command += ' --ez "android.intent.extra.START_PLAYBACK" true';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
command += ` -a android.intent.action.VIEW 'plex://server://${serverID}/${provider}${mediaID}'`;
|
|
|
|
command += ` -a android.intent.action.VIEW 'plex://server://${serverID}/${provider}${mediaID}'`;
|
|
|
|
console.log(command);
|
|
|
|
|
|
|
|
this.hass.callService('androidtv', 'adb_command', {
|
|
|
|
this.hass.callService('androidtv', 'adb_command', {
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
entity_id: entityName,
|
|
|
|
entity_id: entityName,
|
|
|
|