|
|
|
@ -19538,16 +19538,16 @@ class PlayController {
|
|
|
|
|
try {
|
|
|
|
|
switch (processData.type) {
|
|
|
|
|
case 'artist':
|
|
|
|
|
await this.playViaCastPlex(entity.value, 'MUSIC', `plex://${JSON.stringify({
|
|
|
|
|
await this.playViaCastPlex(entity.value, 'MUSIC', {
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
library_name: libraryName,
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
artist_name: processData.title,
|
|
|
|
|
shuffle: this.shuffle ? 1 : 0
|
|
|
|
|
})}`);
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
case 'album':
|
|
|
|
|
await this.playViaCastPlex(entity.value, 'MUSIC', `plex://${JSON.stringify({
|
|
|
|
|
await this.playViaCastPlex(entity.value, 'MUSIC', {
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
library_name: libraryName,
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
@ -19555,10 +19555,10 @@ class PlayController {
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
album_name: processData.title,
|
|
|
|
|
shuffle: this.shuffle ? 1 : 0
|
|
|
|
|
})}`);
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
case 'track':
|
|
|
|
|
await this.playViaCastPlex(entity.value, 'MUSIC', `plex://${JSON.stringify({
|
|
|
|
|
await this.playViaCastPlex(entity.value, 'MUSIC', {
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
library_name: libraryName,
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
@ -19568,17 +19568,17 @@ class PlayController {
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
track_name: processData.title,
|
|
|
|
|
shuffle: this.shuffle ? 1 : 0
|
|
|
|
|
})}`);
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
case 'movie':
|
|
|
|
|
await this.playViaCastPlex(entity.value, 'movie', `plex://${JSON.stringify({
|
|
|
|
|
await this.playViaCastPlex(entity.value, 'movie', {
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
library_name: libraryName,
|
|
|
|
|
title: processData.title
|
|
|
|
|
})}`);
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
case 'episode':
|
|
|
|
|
await this.playViaCastPlex(entity.value, 'EPISODE', `plex://${JSON.stringify({
|
|
|
|
|
await this.playViaCastPlex(entity.value, 'EPISODE', {
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
library_name: libraryName,
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
@ -19587,7 +19587,7 @@ class PlayController {
|
|
|
|
|
season_number: processData.parentIndex,
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
episode_number: processData.index
|
|
|
|
|
})}`);
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (!lodash.isNil(processData.Media)) {
|
|
|
|
@ -19811,14 +19811,20 @@ class PlayController {
|
|
|
|
|
this.hass.callService('media_player', 'play_media', payload);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
this.playViaCastPlex = (entityName, contentType, mediaLink) => {
|
|
|
|
|
this.playViaCastPlex = (entityName, contentType, payload) => {
|
|
|
|
|
const friendlyServerName = lodash.get(this.plex, 'serverInfo.friendlyName');
|
|
|
|
|
const plexPayload = lodash.clone(payload);
|
|
|
|
|
if (friendlyServerName) {
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
plexPayload.plex_server = friendlyServerName;
|
|
|
|
|
}
|
|
|
|
|
return 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: contentType,
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
|
|
|
media_content_id: mediaLink
|
|
|
|
|
media_content_id: `plex://${JSON.stringify(plexPayload)}`
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
this.playViaAndroidTV = async (entityName, mediaID, instantPlay = false, provider = 'com.plexapp.plugins.library') => {
|
|
|
|
|