|
|
@ -18806,19 +18806,29 @@ class PlayController {
|
|
|
|
this.playViaPlexPlayer = async (movieID) => {
|
|
|
|
this.playViaPlexPlayer = async (movieID) => {
|
|
|
|
const { playQueueID, playQueueSelectedMetadataItemID } = await this.plexPlayerCreateQueue(movieID);
|
|
|
|
const { playQueueID, playQueueSelectedMetadataItemID } = await this.plexPlayerCreateQueue(movieID);
|
|
|
|
const url = `${this.plex.protocol}://${this.plex.ip}:${this.plex.port}/player/playback/playMedia?address=${this.plex.ip}&commandID=1&containerKey=/playQueues/${playQueueID}?window=100%26own=1&key=/library/metadata/${playQueueSelectedMetadataItemID}&machineIdentifier=${await this.plex.getServerID()}&offset=0&port=${this.plex.port}&token=${this.plex.token}&type=video&protocol=${this.plex.protocol}`;
|
|
|
|
const url = `${this.plex.protocol}://${this.plex.ip}:${this.plex.port}/player/playback/playMedia?address=${this.plex.ip}&commandID=1&containerKey=/playQueues/${playQueueID}?window=100%26own=1&key=/library/metadata/${playQueueSelectedMetadataItemID}&machineIdentifier=${await this.plex.getServerID()}&offset=0&port=${this.plex.port}&token=${this.plex.token}&type=video&protocol=${this.plex.protocol}`;
|
|
|
|
const plexResponse = await axios({
|
|
|
|
try {
|
|
|
|
method: 'post',
|
|
|
|
const plexResponse = await axios({
|
|
|
|
url,
|
|
|
|
method: 'post',
|
|
|
|
headers: {
|
|
|
|
url,
|
|
|
|
'X-Plex-Target-Client-Identifier': this.entity.plexPlayer,
|
|
|
|
headers: {
|
|
|
|
'X-Plex-Client-Identifier': 'PlexMeetsHomeAssistant'
|
|
|
|
'X-Plex-Target-Client-Identifier': this.entity.plexPlayer,
|
|
|
|
|
|
|
|
'X-Plex-Client-Identifier': 'PlexMeetsHomeAssistant'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
if (plexResponse.status !== 200) {
|
|
|
|
|
|
|
|
throw Error('Error while asking plex to play a movie - server request error.');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!lodash.includes(plexResponse.data, 'status="OK"')) {
|
|
|
|
|
|
|
|
throw Error('Error while asking plex to play a movie - target device not available.');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (plexResponse.status !== 200) {
|
|
|
|
|
|
|
|
throw Error('Error while asking plex to play a movie - server request error.');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!lodash.includes(plexResponse.data, 'status="OK"')) {
|
|
|
|
catch (err) {
|
|
|
|
throw Error('Error while asking plex to play a movie - target device not available.');
|
|
|
|
if (lodash.includes(err.message, '404')) {
|
|
|
|
|
|
|
|
throw Error('Defined plexPlayer is currently not available for playback.');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
throw err;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.playViaKodi = async (data, type) => {
|
|
|
|
this.playViaKodi = async (data, type) => {
|
|
|
|