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