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