@ -17207,7 +17207,8 @@ const supported = {
kodi : [ 'movie' , 'episode' , 'epg' ] ,
androidtv : [ 'movie' , 'show' , 'season' , 'episode' , 'clip' , 'track' , 'artist' , 'album' ] ,
plexPlayer : [ 'movie' , 'show' , 'season' , 'episode' , 'clip' , 'track' , 'artist' , 'album' ] ,
cast : [ 'movie' , 'episode' , 'artist' , 'album' , 'track' ]
cast : [ 'movie' , 'episode' , 'artist' , 'album' , 'track' ] ,
vlcTelnet : [ 'track' ]
} ;
var bind = function bind ( fn , thisArg ) {
@ -19508,6 +19509,9 @@ class PlayController {
case 'kodi' :
await this . playViaKodi ( entity . value , data , data . type ) ;
break ;
case 'vlcTelnet' :
await this . playViaVLCTelnet ( entity . value , data . Media [ 0 ] . Part [ 0 ] . key , data . type ) ;
break ;
case 'androidtv' :
if ( lodash . isEqual ( data . type , 'epg' ) ) {
const session = ` ${ Math . floor ( Date . now ( ) / 1000 ) } ` ;
@ -19752,6 +19756,22 @@ class PlayController {
throw Error ( ` Plex type ${ type } is not supported in Kodi. ` ) ;
}
} ;
this . playViaVLCTelnet = async ( entityName , mediaLink , type ) => {
switch ( type ) {
case 'track' :
this . hass . callService ( 'media_player' , 'play_media' , {
// eslint-disable-next-line @typescript-eslint/camelcase
entity _id : entityName ,
// eslint-disable-next-line @typescript-eslint/camelcase
media _content _type : 'music' ,
// eslint-disable-next-line @typescript-eslint/camelcase
media _content _id : this . plex . authorizeURL ( ` ${ this . plex . getBasicURL ( ) } ${ mediaLink } ` )
} ) ;
break ;
default :
console . error ( ` Type ${ type } is not supported on entity ${ entityName } . ` ) ;
}
} ;
this . playViaCast = ( entityName , mediaLink , contentType = 'video' ) => {
if ( lodash . isEqual ( contentType , 'video' ) ) {
this . hass . callService ( 'media_player' , 'play_media' , {
@ -19966,11 +19986,11 @@ class PlayController {
const entities = this . exportEntity ( value , key ) ;
lodash . forEach ( entities , entity => {
if ( lodash . includes ( this . supported [ entity . key ] , data . type ) ) {
// todo: load info in this.entityStates otherwise this will never work for input selects and templates
if ( ( entity . key === 'kodi' && this . isKodiSupported ( entity . value ) ) ||
( entity . key === 'androidtv' && this . isAndroidTVSupported ( entity . value ) ) ||
( entity . key === 'plexPlayer' && this . isPlexPlayerSupported ( entity . value ) ) ||
( entity . key === 'cast' && this . isCastSupported ( entity . value ) ) ) {
( entity . key === 'cast' && this . isCastSupported ( entity . value ) ) ||
( entity . key === 'vlcTelnet' && this . isVLCTelnetSupported ( entity . value ) ) ) {
service = { key : entity . key , value : entity . value } ;
return false ;
}
@ -20126,6 +20146,12 @@ class PlayController {
}
return false ;
} ;
this . isVLCTelnetSupported = ( entityName ) => {
return ( ( this . entityStates [ entityName ] &&
! lodash . isNil ( this . entityStates [ entityName ] . attributes ) &&
this . entityStates [ entityName ] . state !== 'unavailable' ) ||
! lodash . isEqual ( this . runBefore , false ) ) ;
} ;
this . isCastSupported = ( entityName ) => {
return ( ( this . entityStates [ entityName ] &&
! lodash . isNil ( this . entityStates [ entityName ] . attributes ) &&
@ -22039,11 +22065,15 @@ class PlexMeetsHomeAssistant extends HTMLElement {
realEntityString = entityString . split ( ' | ' ) [ 3 ] ;
isPlexPlayer = true ;
}
else if ( lodash . isPlainObject ( entityString ) ) {
realEntityString = entityString [ Object . keys ( entityString ) [ 0 ] ] ;
}
else if ( lodash . startsWith ( entityString , 'androidtv | ' ) ||
lodash . startsWith ( entityString , 'kodi | ' ) ||
lodash . startsWith ( entityString , 'cast | ' ) ||
lodash . startsWith ( entityString , 'input_select | ' ) ||
lodash . startsWith ( entityString , 'input_text | ' ) ) {
lodash . startsWith ( entityString , 'input_text | ' ) ||
lodash . startsWith ( entityString , 'vlc_telnet | ' ) ) {
// eslint-disable-next-line prefer-destructuring
realEntityString = entityString . split ( ' | ' ) [ 1 ] ;
isPlexPlayer = false ;
@ -22094,7 +22124,15 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}
entityObj . inputText . push ( entityInRegister . entity _id ) ;
break ;
// pass
case 'vlc_telnet' :
if ( lodash . isNil ( entityObj . vlcTelnet ) ) {
// eslint-disable-next-line no-param-reassign
entityObj . vlcTelnet = [ ] ;
}
entityObj . vlcTelnet . push ( entityInRegister . entity _id ) ;
break ;
default :
console . error ( ` Entity ${ entityInRegister . entity _id } is not supported. ` ) ;
}
}
} ) ;