@ -17205,9 +17205,9 @@ const CSS_STYLE = {
} ;
const supported = {
kodi : [ 'movie' , 'episode' ] ,
androidtv : [ 'movie' , 'show' , 'season' , 'episode' , 'clip' ],
plexPlayer : [ 'movie' , 'show' , 'season' , 'episode' , 'clip' ],
cast : [ 'movie' , 'episode' ]
androidtv : [ 'movie' , 'show' , 'season' , 'episode' , 'clip' , 'epg' ],
plexPlayer : [ 'movie' , 'show' , 'season' , 'episode' , 'clip' , 'epg' ],
cast : [ 'movie' , 'episode' , 'epg' ]
} ;
var bind = function bind ( fn , thisArg ) {
@ -19283,6 +19283,7 @@ class PlayController {
return foundResult ;
} ;
this . play = async ( data , instantPlay = false ) => {
console . log ( 'play' ) ;
if ( lodash . isArray ( this . runBefore ) ) {
const entityID = ` ${ this . runBefore [ 0 ] } . ${ this . runBefore [ 1 ] } ` ;
await this . hass . callService ( this . runBefore [ 0 ] , this . runBefore [ 1 ] , { } ) ;
@ -19292,26 +19293,35 @@ class PlayController {
}
}
const entity = this . getPlayService ( data ) ;
let processData = data ;
let provider ;
if ( ! lodash . isNil ( data . epg ) ) {
processData = data . epg ;
provider = '' ;
}
console . log ( processData ) ;
switch ( entity . key ) {
case 'kodi' :
await this . playViaKodi ( entity . value , data , data . type ) ;
await this . playViaKodi ( entity . value , processData, processD ata. type ) ;
break ;
case 'androidtv' :
await this . playViaAndroidTV ( entity . value , data . key . split ( '/' ) [ 3 ] , instantPlay ) ;
await this . playViaAndroidTV ( entity . value , processData. key , instantPlay , provider ) ;
break ;
case 'plexPlayer' :
await this . playViaPlexPlayer ( entity . value , d ata. key . split ( '/' ) [ 3 ] ) ;
await this . playViaPlexPlayer ( entity . value , processD ata. key . split ( '/' ) [ 3 ] ) ;
break ;
case 'cast' :
if ( this . hass . services . plex ) {
const libraryName = lodash . isNil ( data . librarySectionTitle ) ? this . libraryName : data . librarySectionTitle ;
const libraryName = lodash . isNil ( processData . librarySectionTitle )
? this . libraryName
: processData . librarySectionTitle ;
try {
switch ( data . type ) {
switch ( processD ata. type ) {
case 'movie' :
await this . playViaCastPlex ( entity . value , 'movie' , ` plex:// ${ JSON . stringify ( {
// eslint-disable-next-line @typescript-eslint/camelcase
library _name : libraryName ,
title : d ata. title
title : processD ata. title
} ) } ` );
break ;
case 'episode' :
@ -19319,28 +19329,28 @@ class PlayController {
// eslint-disable-next-line @typescript-eslint/camelcase
library _name : libraryName ,
// eslint-disable-next-line @typescript-eslint/camelcase
show _name : d ata. grandparentTitle ,
show _name : processD ata. grandparentTitle ,
// eslint-disable-next-line @typescript-eslint/camelcase
season _number : d ata. parentIndex ,
season _number : processD ata. parentIndex ,
// eslint-disable-next-line @typescript-eslint/camelcase
episode _number : d ata. index
episode _number : processD ata. index
} ) } ` );
break ;
default :
this . playViaCast ( entity . value , d ata. Media [ 0 ] . Part [ 0 ] . key ) ;
this . playViaCast ( entity . value , processD ata. Media [ 0 ] . Part [ 0 ] . key ) ;
}
}
catch ( err ) {
console . log ( err ) ;
this . playViaCast ( entity . value , d ata. Media [ 0 ] . Part [ 0 ] . key ) ;
this . playViaCast ( entity . value , processD ata. Media [ 0 ] . Part [ 0 ] . key ) ;
}
}
else {
this . playViaCast ( entity . value , d ata. Media [ 0 ] . Part [ 0 ] . key ) ;
this . playViaCast ( entity . value , processD ata. Media [ 0 ] . Part [ 0 ] . key ) ;
}
break ;
default :
throw Error ( ` No service available to play ${ d ata. title } ! ` ) ;
throw Error ( ` No service available to play ${ processD ata. title } ! ` ) ;
}
if ( lodash . isArray ( this . runAfter ) ) {
await this . hass . callService ( this . runAfter [ 0 ] , this . runAfter [ 1 ] , { } ) ;
@ -19481,13 +19491,14 @@ class PlayController {
media _content _id : mediaLink
} ) ;
} ;
this . playViaAndroidTV = async ( entityName , mediaID , instantPlay = false ) => {
this . playViaAndroidTV = async ( entityName , mediaID , instantPlay = false , provider = 'com.plexapp.plugins.library' ) => {
const serverID = await this . plex . getServerID ( ) ;
let command = ` am start ` ;
if ( instantPlay ) {
command += ' --ez "android.intent.extra.START_PLAYBACK" true' ;
}
command += ` -a android.intent.action.VIEW 'plex://server:// ${ serverID } /com.plexapp.plugins.library/library/metadata/ ${ mediaID } ' ` ;
command += ` -a android.intent.action.VIEW 'plex://server:// ${ serverID } / ${ provider } ${ mediaID } ' ` ;
console . log ( command ) ;
this . hass . callService ( 'androidtv' , 'adb_command' , {
// eslint-disable-next-line @typescript-eslint/camelcase
entity _id : entityName ,
@ -21302,6 +21313,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
lodash . forEach ( this . data [ key ] , ( libraryData , libraryKey ) => {
if ( ! lodash . isNil ( this . epgData [ key ] [ libraryData . channelCallSign ] ) ) {
this . data [ key ] [ libraryKey ] . epg = this . epgData [ key ] [ libraryData . channelCallSign ] ;
this . data [ key ] [ libraryKey ] . type = 'epg' ;
}
} ) ;
} ) ;
@ -21850,7 +21862,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
fullscreenTrailer . style . visibility = 'hidden' ;
} ;
this . showDetails = async ( data ) => {
console . log ( data ) ;
this . detailsShown = true ;
const top = this . getTop ( ) ;
if ( this . detailElem ) {