|
|
@ -19053,6 +19053,20 @@ const getOffset = (el) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return { top: y, left: x };
|
|
|
|
return { top: y, left: x };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const findTrailerURL = (movieData) => {
|
|
|
|
|
|
|
|
console.log(movieData.Extras);
|
|
|
|
|
|
|
|
console.log(movieData.Extras.Metadata);
|
|
|
|
|
|
|
|
let foundURL = '';
|
|
|
|
|
|
|
|
if (movieData.Extras && movieData.Extras.Metadata && movieData.Extras.Metadata.length > 0) {
|
|
|
|
|
|
|
|
lodash.forEach(movieData.Extras.Metadata, extra => {
|
|
|
|
|
|
|
|
if (extra.subtype === 'trailer') {
|
|
|
|
|
|
|
|
foundURL = extra.Media[0].Part[0].key;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return foundURL;
|
|
|
|
|
|
|
|
};
|
|
|
|
const createEpisodesView = (playController, plexProtocol, ip, port, token, data) => {
|
|
|
|
const createEpisodesView = (playController, plexProtocol, ip, port, token, data) => {
|
|
|
|
const episodeContainer = document.createElement('div');
|
|
|
|
const episodeContainer = document.createElement('div');
|
|
|
|
episodeContainer.className = 'episodeContainer';
|
|
|
|
episodeContainer.className = 'episodeContainer';
|
|
|
@ -19387,7 +19401,7 @@ style.textContent = css `
|
|
|
|
display: none;
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.episodes {
|
|
|
|
.episodes {
|
|
|
|
z-index: 4;
|
|
|
|
z-index: 5;
|
|
|
|
position: absolute;
|
|
|
|
position: absolute;
|
|
|
|
top: ${CSS_STYLE.expandedHeight + 16}px;
|
|
|
|
top: ${CSS_STYLE.expandedHeight + 16}px;
|
|
|
|
width: calc(100% - 32px);
|
|
|
|
width: calc(100% - 32px);
|
|
|
@ -19513,7 +19527,7 @@ style.textContent = css `
|
|
|
|
position: absolute;
|
|
|
|
position: absolute;
|
|
|
|
left: 247px;
|
|
|
|
left: 247px;
|
|
|
|
width: calc(100% - 267px);
|
|
|
|
width: calc(100% - 267px);
|
|
|
|
z-index: 4;
|
|
|
|
z-index: 5;
|
|
|
|
transition: 0.5s;
|
|
|
|
transition: 0.5s;
|
|
|
|
color: rgba(255, 255, 255, 0);
|
|
|
|
color: rgba(255, 255, 255, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -19637,10 +19651,11 @@ style.textContent = css `
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.video {
|
|
|
|
.video {
|
|
|
|
position: absolute;
|
|
|
|
position: absolute;
|
|
|
|
z-index: 5;
|
|
|
|
z-index: 3;
|
|
|
|
|
|
|
|
visibility: hidden;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.movieExtras {
|
|
|
|
.movieExtras {
|
|
|
|
z-index: 4;
|
|
|
|
z-index: 5;
|
|
|
|
position: absolute;
|
|
|
|
position: absolute;
|
|
|
|
top: 340px;
|
|
|
|
top: 340px;
|
|
|
|
width: calc(100% - 32px);
|
|
|
|
width: calc(100% - 32px);
|
|
|
@ -19945,14 +19960,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
this.hideBackground();
|
|
|
|
this.hideBackground();
|
|
|
|
this.minimizeAll();
|
|
|
|
this.minimizeAll();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
const player = document.createElement('video');
|
|
|
|
|
|
|
|
player.style.height = '100%';
|
|
|
|
|
|
|
|
player.style.width = '100%';
|
|
|
|
|
|
|
|
player.controls = true;
|
|
|
|
|
|
|
|
const source = document.createElement('source');
|
|
|
|
|
|
|
|
source.type = 'video/mp4';
|
|
|
|
|
|
|
|
player.appendChild(source);
|
|
|
|
|
|
|
|
this.videoElem.appendChild(player);
|
|
|
|
|
|
|
|
this.content.appendChild(this.videoElem);
|
|
|
|
this.content.appendChild(this.videoElem);
|
|
|
|
// todo: figure out why timeout is needed here and do it properly
|
|
|
|
// todo: figure out why timeout is needed here and do it properly
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
@ -20025,6 +20032,11 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
this.hideVideo = () => {
|
|
|
|
|
|
|
|
if (this.videoElem) {
|
|
|
|
|
|
|
|
this.videoElem.innerHTML = '';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
this.minimizeAll = () => {
|
|
|
|
this.minimizeAll = () => {
|
|
|
|
this.detailsShown = false;
|
|
|
|
this.detailsShown = false;
|
|
|
|
if (this.activeMovieElem) {
|
|
|
|
if (this.activeMovieElem) {
|
|
|
@ -20045,6 +20057,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
this.hideSeasons();
|
|
|
|
this.hideSeasons();
|
|
|
|
this.hideEpisodes();
|
|
|
|
this.hideEpisodes();
|
|
|
|
this.hideDetails();
|
|
|
|
this.hideDetails();
|
|
|
|
|
|
|
|
this.hideVideo();
|
|
|
|
clearInterval(this.showDetailsTimeout);
|
|
|
|
clearInterval(this.showDetailsTimeout);
|
|
|
|
clearInterval(this.showSeasonElemTimeout);
|
|
|
|
clearInterval(this.showSeasonElemTimeout);
|
|
|
|
clearInterval(this.seasonTitleColorTimeout);
|
|
|
|
clearInterval(this.seasonTitleColorTimeout);
|
|
|
@ -20322,11 +20335,28 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
const movieDetails = await this.plex.getDetails(data.key.split('/')[3]);
|
|
|
|
const movieDetails = await this.plex.getDetails(data.key.split('/')[3]);
|
|
|
|
if (this.videoElem) {
|
|
|
|
if (this.videoElem) {
|
|
|
|
const videoElem = this.videoElem.children[0];
|
|
|
|
const trailerURL = findTrailerURL(movieDetails);
|
|
|
|
const sourceElem = videoElem.children[0];
|
|
|
|
if (trailerURL !== '') {
|
|
|
|
sourceElem.src = this.plex.authorizeURL(`${this.plex.getBasicURL()}${movieDetails.Extras.Metadata[0].Media[0].Part[0].key}`);
|
|
|
|
const video = document.createElement('video');
|
|
|
|
videoElem.load();
|
|
|
|
video.style.height = '100%';
|
|
|
|
videoElem.play();
|
|
|
|
video.style.width = '100%';
|
|
|
|
|
|
|
|
video.controls = false;
|
|
|
|
|
|
|
|
const source = document.createElement('source');
|
|
|
|
|
|
|
|
source.type = 'video/mp4';
|
|
|
|
|
|
|
|
source.src = this.plex.authorizeURL(`${this.plex.getBasicURL()}${movieDetails.Extras.Metadata[0].Media[0].Part[0].key}`);
|
|
|
|
|
|
|
|
video.appendChild(source);
|
|
|
|
|
|
|
|
this.videoElem.appendChild(video);
|
|
|
|
|
|
|
|
video.load();
|
|
|
|
|
|
|
|
video.play();
|
|
|
|
|
|
|
|
let playingFired = false;
|
|
|
|
|
|
|
|
video.addEventListener('playing', () => {
|
|
|
|
|
|
|
|
if (this.videoElem && !playingFired) {
|
|
|
|
|
|
|
|
playingFired = true;
|
|
|
|
|
|
|
|
this.videoElem.style.visibility = 'visible';
|
|
|
|
|
|
|
|
this.videoElem.style.top = `${top}px`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log();
|
|
|
|
console.log();
|
|
|
|
const extras = movieDetails.Extras.Metadata;
|
|
|
|
const extras = movieDetails.Extras.Metadata;
|
|
|
|