|
|
@ -18698,7 +18698,7 @@ class Plex {
|
|
|
|
|
|
|
|
|
|
|
|
class PlayController {
|
|
|
|
class PlayController {
|
|
|
|
constructor(hass, plex, entity) {
|
|
|
|
constructor(hass, plex, entity) {
|
|
|
|
this.play = async (mediaID) => {
|
|
|
|
this.play = async (mediaID, instantPlay = false) => {
|
|
|
|
const serverID = await this.plex.getServerID();
|
|
|
|
const serverID = await this.plex.getServerID();
|
|
|
|
const command = `am start -a android.intent.action.VIEW 'plex://server://${serverID}/com.plexapp.plugins.library/library/metadata/${mediaID}'`;
|
|
|
|
const command = `am start -a android.intent.action.VIEW 'plex://server://${serverID}/com.plexapp.plugins.library/library/metadata/${mediaID}'`;
|
|
|
|
console.log(command);
|
|
|
|
console.log(command);
|
|
|
@ -18712,6 +18712,17 @@ class PlayController {
|
|
|
|
entity_id: this.entity,
|
|
|
|
entity_id: this.entity,
|
|
|
|
command
|
|
|
|
command
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
if (instantPlay) {
|
|
|
|
|
|
|
|
console.log('instantPlay');
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
console.log('PLAY');
|
|
|
|
|
|
|
|
this.hass.callService('androidtv', 'adb_command', {
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
|
|
|
entity_id: this.entity,
|
|
|
|
|
|
|
|
command: 'CENTER'
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}, 5000);
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.isPlaySupported = () => {
|
|
|
|
this.isPlaySupported = () => {
|
|
|
|
return (this.hass.states[this.entity] &&
|
|
|
|
return (this.hass.states[this.entity] &&
|
|
|
@ -19694,7 +19705,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
episodePlayButton.addEventListener('click', episodeEvent => {
|
|
|
|
episodePlayButton.addEventListener('click', episodeEvent => {
|
|
|
|
episodeEvent.stopPropagation();
|
|
|
|
episodeEvent.stopPropagation();
|
|
|
|
if (this.plex && this.playController) {
|
|
|
|
if (this.plex && this.playController) {
|
|
|
|
this.playController.play(episodeData.key.split('/')[3]);
|
|
|
|
this.playController.play(episodeData.key.split('/')[3], true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
episodeInteractiveArea.append(episodePlayButton);
|
|
|
|
episodeInteractiveArea.append(episodePlayButton);
|
|
|
|