@ -18669,7 +18669,7 @@ var axios = axios_1;
/* eslint-disable @typescript-eslint/no-explicit-any */
class Plex {
constructor ( ip , port = 32400 , token , protocol = 'http' , sort = 'titleSort:asc' ) {
constructor ( ip , port = false , token , protocol = 'http' , sort = 'titleSort:asc' ) {
this . serverInfo = { } ;
this . clients = [ ] ;
this . requestTimeout = 5000 ;
@ -18791,7 +18791,7 @@ class Plex {
return onDeckData ;
} ;
this . getBasicURL = ( ) => {
return ` ${ this . protocol } :// ${ this . ip } : ${ this . port } ` ;
return ` ${ this . protocol } :// ${ this . ip } ${ this . port === false ? '' : ` : ${ this . port } ` } ` ;
} ;
this . authorizeURL = ( url ) => {
if ( ! lodash . includes ( url , 'X-Plex-Token' ) ) {
@ -19191,11 +19191,11 @@ const findTrailerURL = (movieData) => {
}
return foundURL ;
} ;
const createEpisodesView = ( playController , plex Protocol, ip , port , token , data ) => {
const createEpisodesView = ( playController , plex , data ) => {
const episodeContainer = document . createElement ( 'div' ) ;
episodeContainer . className = 'episodeContainer' ;
episodeContainer . style . width = ` ${ CSS _STYLE . episodeWidth } px ` ;
const episodeThumbURL = ` ${ plexProtocol } :// ${ ip } : ${ port } /photo/:/transcode?width= ${ CSS _STYLE . episodeWidth } &height= ${ CSS _STYLE . episodeHeight } &minSize=1&upscale=1&url= ${ data . thumb } &X-Plex-Token=${ token } ` ;
const episodeThumbURL = plex . authorizeURL ( ` ${ plex . getBasicURL ( ) } /photo/:/transcode?width= ${ CSS _STYLE . episodeWidth } &height= ${ CSS _STYLE . episodeHeight } &minSize=1&upscale=1&url= ${ data . thumb } `) ;
const episodeElem = document . createElement ( 'div' ) ;
episodeElem . className = 'episodeElem' ;
episodeElem . style . width = ` ${ CSS _STYLE . episodeWidth } px ` ;
@ -19978,6 +19978,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
constructor ( ) {
super ( ... arguments ) ;
this . plexProtocol = 'http' ;
this . plexPort = false ;
this . detailsShown = false ;
this . runBefore = '' ;
this . playTrailer = true ;
@ -20753,12 +20754,12 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this . seasonsElem . style . top = ` ${ top + 2000 } px ` ;
}
lodash . forEach ( seasonsData , seasonData => {
if ( this . seasonsElem ) {
if ( this . seasonsElem && this . plex ) {
this . seasonsElemHidden = false ;
const seasonContainer = document . createElement ( 'div' ) ;
seasonContainer . className = 'seasonContainer' ;
seasonContainer . style . width = ` ${ CSS _STYLE . width } px ` ;
const thumbURL = ` ${ this . plex Protocol} :// ${ this . config . ip } : ${ this . config . port } /photo/:/transcode?width= ${ CSS _STYLE . expandedWidth } &height= ${ CSS _STYLE . expandedHeight } &minSize=1&upscale=1&url= ${ seasonData . thumb } &X-Plex-Token= ${ this . config . token } ` ;
const thumbURL = ` ${ this . plex . getBasicURL ( ) } /photo/:/transcode?width= ${ CSS _STYLE . expandedWidth } &height= ${ CSS _STYLE . expandedHeight } &minSize=1&upscale=1&url= ${ seasonData . thumb } &X-Plex-Token= ${ this . config . token } ` ;
const seasonElem = document . createElement ( 'div' ) ;
seasonElem . className = 'seasonElem' ;
seasonElem . style . width = ` ${ CSS _STYLE . width } px ` ;
@ -20838,8 +20839,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this . episodesElem . style . transition = ` 0s ` ;
this . episodesElem . style . top = ` ${ top + 2000 } px ` ;
lodash . forEach ( episodesData , episodeData => {
if ( this . episodesElem && this . playController ) {
this . episodesElem . append ( createEpisodesView ( this . playController , this . plex Protocol, this . config . ip , this . config . port , this . config . token , episodeData ) ) ;
if ( this . episodesElem && this . playController && this . plex ) {
this . episodesElem . append ( createEpisodesView ( this . playController , this . plex , episodeData ) ) ;
}
} ) ;
clearInterval ( this . episodesLoadTimeout ) ;
@ -20918,8 +20919,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if ( this . showExtras ) {
const extras = dataDetails . Extras . Metadata ;
lodash . forEach ( extras , extrasData => {
if ( this . episodesElem && this . playController ) {
this . episodesElem . append ( createEpisodesView ( this . playController , this . plex Protocol, this . config . ip , this . config . port , this . config . token , extrasData ) ) ;
if ( this . episodesElem && this . playController && this . plex ) {
this . episodesElem . append ( createEpisodesView ( this . playController , this . plex , extrasData ) ) ;
}
} ) ;
}
@ -21012,11 +21013,13 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} ;
this . getMovieElement = ( data , hasAdditionalData = false ) => {
let thumbURL = '' ;
if ( lodash . isEqual ( data . type , 'episode' ) ) {
thumbURL = ` ${ this . plexProtocol } :// ${ this . config . ip } : ${ this . config . port } /photo/:/transcode?width= ${ CSS _STYLE . expandedWidth } &height= ${ CSS _STYLE . expandedHeight } &minSize=1&upscale=1&url= ${ data . grandparentThumb } &X-Plex-Token= ${ this . config . token } ` ;
}
else {
thumbURL = ` ${ this . plexProtocol } :// ${ this . config . ip } : ${ this . config . port } /photo/:/transcode?width= ${ CSS _STYLE . expandedWidth } &height= ${ CSS _STYLE . expandedHeight } &minSize=1&upscale=1&url= ${ data . thumb } &X-Plex-Token= ${ this . config . token } ` ;
if ( this . plex ) {
if ( lodash . isEqual ( data . type , 'episode' ) ) {
thumbURL = ` ${ this . plex . getBasicURL ( ) } /photo/:/transcode?width= ${ CSS _STYLE . expandedWidth } &height= ${ CSS _STYLE . expandedHeight } &minSize=1&upscale=1&url= ${ data . grandparentThumb } &X-Plex-Token= ${ this . config . token } ` ;
}
else {
thumbURL = ` ${ this . plex . getBasicURL ( ) } /photo/:/transcode?width= ${ CSS _STYLE . expandedWidth } &height= ${ CSS _STYLE . expandedHeight } &minSize=1&upscale=1&url= ${ data . thumb } &X-Plex-Token= ${ this . config . token } ` ;
}
}
const container = document . createElement ( 'div' ) ;
container . className = 'container' ;
@ -21130,9 +21133,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if ( ! config . ip ) {
throw new Error ( 'You need to define a ip' ) ;
}
if ( ! config . port ) {
throw new Error ( 'You need to define a port' ) ;
}
if ( ! config . libraryName ) {
throw new Error ( 'You need to define a libraryName' ) ;
}
@ -21140,6 +21140,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if ( config . protocol ) {
this . plexProtocol = config . protocol ;
}
if ( config . port ) {
this . plexPort = config . port ;
}
if ( config . maxCount ) {
this . maxCount = config . maxCount ;
}
@ -21155,7 +21158,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if ( ! lodash . isNil ( config . showExtras ) ) {
this . showExtras = config . showExtras ;
}
this . plex = new Plex ( this . config . ip , this . config. port, this . config . token , this . plexProtocol , this . config . sort ) ;
this . plex = new Plex ( this . config . ip , this . plexP ort, this . config . token , this . plexProtocol , this . config . sort ) ;
} ;
this . getCardSize = ( ) => {
return 3 ;