[kaleidescape] Add configuration option to auto load metadata channels without rules (#11231)

* Add configuration option to auto load metadata channels

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>

* Debug message

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
mlobstein
2021-09-14 09:55:48 -05:00
committed by GitHub
parent f0df1a45cc
commit db935d3a3b
8 changed files with 101 additions and 53 deletions

View File

@@ -45,14 +45,16 @@ All settings are through thing configuration parameters.
The thing has the following configuration parameters:
| Parameter Label | Parameter ID | Description | Accepted values |
|------------------------|---------------|------------------------------------------------------------------------------------|------------------------------------------------------|
| Address | host | Host name or IP address of the Kaleidescape component | A host name or IP address |
| Port | port | Communication port of the IP connection | 10000 (default - should not need to change) |
| Serial Port | serialPort | Serial port for connecting directly a component | Serial port name (optional) |
| Update Period | updatePeriod | Tells the component how often time status updates should be sent (see notes below) | 0 or 1 are the currently accepted values (default 0) |
| Volume Control Enabled | volumeEnabled | Enable the volume and mute controls in the K iPad & phone apps | Boolean (default false) |
| Initial Volume Setting | initialVolume | Initial volume level set when the binding starts up | 0 to 75 (default 25) |
| Parameter Label | Parameter ID | Description | Accepted values |
|--------------------------|------------------------|--------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| Address | host | Host name or IP address of the Kaleidescape component | A host name or IP address |
| Port | port | Communication port of the IP connection | 10000 (default - should not need to change) |
| Serial Port | serialPort | Serial port for connecting directly a component | Serial port name (optional) |
| Update Period | updatePeriod | Tells the component how often time status updates should be sent (see notes below) | 0 or 1 are the currently accepted values (default 0) |
| Volume Control Enabled | volumeEnabled | Enable the volume and mute controls in the K iPad & phone apps | Boolean (default false) |
| Initial Volume Setting | initialVolume | Initial volume level set when the binding starts up | 0 to 75 (default 25) |
| Load Highlighted Details | loadHighlightedDetails | When enabled the binding will automatically load the the metadata channels when the selected item in the UI (Movie or Album) changes | Boolean (default false) |
| Load Album Details | loadAlbumDetails | When enabled the binding will automatically load the metadata channels for the currently playing Album | Boolean (default false) N/A for Alto and Strato |
Some notes:
@@ -152,14 +154,16 @@ The following channels are available:
kaleidescape.things:
```java
kaleidescape:player:myzone1 "M500 Living Rm" [host="192.168.1.10", updatePeriod=0, volumeEnabled=true, initialVolume=20]
kaleidescape:cinemaone:myzone2 "My Cinema One" [host="192.168.1.11", updatePeriod=0, volumeEnabled=true, initialVolume=20]
```
kaleidescape:player:myzone1 "M500 Living Rm" [ host="192.168.1.10", updatePeriod=0, loadHighlightedDetails=true, loadAlbumDetails=true ]
kaleidescape:cinemaone:myzone2 "My Cinema One" [ host="192.168.1.11", updatePeriod=0, loadHighlightedDetails=true, loadAlbumDetails=true ]
kaleidescape:strato:myzone3 "Strato Theater Rm" [ host="192.168.1.12", updatePeriod=0, loadHighlightedDetails=true ]
```
kaleidescape.items:
```java
```
// Virtual switch to send a command, see sitemap and rules below
Switch z1_GoMovieCovers "Go to Movie Covers"
@@ -239,11 +243,12 @@ String z1_Detail_ColorDescription "Color Description: [%s]" { channel="kaleidesc
String z1_Detail_Country "Country: [%s]" { channel="kaleidescape:player:myzone1:detail#country" }
String z1_Detail_AspectRatio "Aspect Ratio: [%s]" { channel="kaleidescape:player:myzone1:detail#aspect_ratio" }
String z1_Detail_DiscLocation "Disc Location: [%s]" { channel="kaleidescape:player:myzone1:detail#disc_location" }
```
ksecondsformat.js:
```java
```
(function(totalSeconds) {
if (isNaN(totalSeconds)) {
return '-';
@@ -265,7 +270,7 @@ ksecondsformat.js:
kaleidescape.sitemap:
```perl
```
sitemap kaleidescape label="Kaleidescape" {
Frame label="Zone 1" {
Image item=z1_Detail_CoverArt
@@ -351,7 +356,7 @@ sitemap kaleidescape label="Kaleidescape" {
kaleidescape.rules:
```java
```
var int lightPercent
val kactions = getActions("kaleidescape","kaleidescape:player:myzone1")
@@ -360,7 +365,7 @@ rule "Go to Movie Covers"
when
Item z1_GoMovieCovers received command
then
if(null === kactions) {
if (null === kactions) {
logInfo("kactions", "Actions not found, check thing ID")
return
}
@@ -372,7 +377,7 @@ rule "Play Script - Great Vistas"
when
Item z1_PlayScript received command
then
if(null === kactions) {
if (null === kactions) {
logInfo("kactions", "Actions not found, check thing ID")
return
}
@@ -389,11 +394,44 @@ then
}
end
rule "Bring up Lights when movie is over"
when
Item z1_Ui_MovieLocation changed from "Main content" to "End Credits"
then
// fade the lights up slowly while the credits are rolling
lightPercent = 0
while (lightPercent < 100) {
lightPercent = lightPercent + 5
logInfo("k rules", "lights at " + lightPercent.toString + " percent")
// myLightItem.sendCommand(lightPercent)
Thread::sleep(5000)
}
end
rule "Bring up Lights at 20 percent during intermission"
when
Item z1_Ui_MovieLocation changed from "Main content" to "Intermission"
then
// myLightItem.sendCommand(20)
logInfo("k rules", "intermission started")
end
rule "Turn lights back off when intermission over"
when
Item z1_Ui_MovieLocation changed from "Intermission" to "Main content"
then
// myLightItem.sendCommand(OFF)
logInfo("k rules", "intermission over")
end
// The following are no longer required since the thing configuration will enable automatic loading of metatdata.
// However the examples are still valid for advanced use cases where retrieving metadata from an arbitrary content handle is desired.
rule "Load selected item Metadata"
when
Item z1_Ui_HighlightedSelection changed
then
if(null === kactions) {
if (null === kactions) {
logInfo("kactions", "Actions not found, check thing ID")
return
}
@@ -404,40 +442,10 @@ rule "Load Metadata for currently playing album"
when
Item z1_Music_AlbumHandle changed
then
if(null === kactions) {
if (null === kactions) {
logInfo("kactions", "Actions not found, check thing ID")
return
}
kactions.sendKCommand("GET_CONTENT_DETAILS:" + z1_Music_AlbumHandle.state.toString + ":")
end
rule "Bring up Lights when movie is over"
when
Item z1_Ui_MovieLocation changed from "Main content" to "End Credits"
then
// fade the lights up slowly while the credits are rolling
lightPercent = 0
while (lightPercent < 100) {
lightPercent = lightPercent + 5
logInfo("k rules", "lights at " + lightPercent.toString + " percent")
//myLightItem.sendCommand(lightPercent)
Thread::sleep(5000)
}
end
rule "Bring up Lights at 20 percent during intermission"
when
Item z1_Ui_MovieLocation changed from "Main content" to "Intermission"
then
//myLightItem.sendCommand(20)
logInfo("k rules", "intermission started")
end
rule "Turn lights back off when intermission over"
when
Item z1_Ui_MovieLocation changed from "Intermission" to "Main content"
then
//myLightItem.sendCommand(OFF)
logInfo("k rules", "intermission over")
end
```