|
|
@ -18861,7 +18861,7 @@ class Plex {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class PlayController {
|
|
|
|
class PlayController {
|
|
|
|
constructor(hass, plex, entity, runBefore, runAfter) {
|
|
|
|
constructor(hass, plex, entity, runBefore, runAfter, libraryName) {
|
|
|
|
this.plexPlayerEntity = '';
|
|
|
|
this.plexPlayerEntity = '';
|
|
|
|
this.runBefore = false;
|
|
|
|
this.runBefore = false;
|
|
|
|
this.runAfter = false;
|
|
|
|
this.runAfter = false;
|
|
|
@ -18940,19 +18940,20 @@ class PlayController {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'cast':
|
|
|
|
case 'cast':
|
|
|
|
if (this.hass.services.plex) {
|
|
|
|
if (this.hass.services.plex) {
|
|
|
|
|
|
|
|
const libraryName = lodash.isNil(data.librarySectionTitle) ? this.libraryName : data.librarySectionTitle;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
switch (data.type) {
|
|
|
|
switch (data.type) {
|
|
|
|
case 'movie':
|
|
|
|
case 'movie':
|
|
|
|
await this.playViaCastPlex(entity.value, 'movie', `plex://${JSON.stringify({
|
|
|
|
await this.playViaCastPlex(entity.value, 'movie', `plex://${JSON.stringify({
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
library_name: data.librarySectionTitle,
|
|
|
|
library_name: libraryName,
|
|
|
|
title: data.title
|
|
|
|
title: data.title
|
|
|
|
})}`);
|
|
|
|
})}`);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'episode':
|
|
|
|
case 'episode':
|
|
|
|
await this.playViaCastPlex(entity.value, 'EPISODE', `plex://${JSON.stringify({
|
|
|
|
await this.playViaCastPlex(entity.value, 'EPISODE', `plex://${JSON.stringify({
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
library_name: data.librarySectionTitle,
|
|
|
|
library_name: libraryName,
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
show_name: data.grandparentTitle,
|
|
|
|
show_name: data.grandparentTitle,
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
@ -19266,6 +19267,7 @@ class PlayController {
|
|
|
|
this.hass = hass;
|
|
|
|
this.hass = hass;
|
|
|
|
this.plex = plex;
|
|
|
|
this.plex = plex;
|
|
|
|
this.entity = entity;
|
|
|
|
this.entity = entity;
|
|
|
|
|
|
|
|
this.libraryName = libraryName;
|
|
|
|
if (!lodash.isEmpty(runBefore) && this.hass.states[runBefore]) {
|
|
|
|
if (!lodash.isEmpty(runBefore) && this.hass.states[runBefore]) {
|
|
|
|
this.runBefore = runBefore.split('.');
|
|
|
|
this.runBefore = runBefore.split('.');
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -20947,7 +20949,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
this.renderPage();
|
|
|
|
this.renderPage();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (this.plex && this.hassObj) {
|
|
|
|
if (this.plex && this.hassObj) {
|
|
|
|
this.playController = new PlayController(this.hassObj, this.plex, entity, this.runBefore, this.runAfter);
|
|
|
|
this.playController = new PlayController(this.hassObj, this.plex, entity, this.runBefore, this.runAfter, this.config.libraryName);
|
|
|
|
if (this.playController) {
|
|
|
|
if (this.playController) {
|
|
|
|
await this.playController.init();
|
|
|
|
await this.playController.init();
|
|
|
|
}
|
|
|
|
}
|
|
|
|