[kaleidescape] Add semantic tags and format time channels (#18550)

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
mlobstein
2025-04-16 23:18:22 +02:00
committed by GitHub
parent 4f5ddec2bb
commit 66df788c55
3 changed files with 164 additions and 76 deletions
@@ -17,7 +17,7 @@ The supported thing types are:
- `player` Any KPlayer, M Class [M300, M500, M700] or Cinema One 1st Gen player
- `cinemaone` Cinema One (2nd Gen)
- `alto`
- `strato` Includes Strato, Strato S, Strato C or Strato V
- `strato` Includes Strato, Strato S, Strato C, Strato V or Strato M
The binding supports either a TCP/IP connection or direct serial port connection (19200-8-N-1) to the Kaleidescape component.
@@ -163,12 +163,12 @@ String z1_Ui_TitleName "Movie Title: [%s]" { channel="kaleidescape:player:myzone
String z1_Ui_PlayMode "Play Mode: [%s]" { channel="kaleidescape:player:myzone1:ui#play_mode" }
String z1_Ui_PlaySpeed "Play Speed: [%s]" { channel="kaleidescape:player:myzone1:ui#play_speed" }
Number z1_Ui_TitleNum "Title Number: [%s]" { channel="kaleidescape:player:myzone1:ui#title_num" }
Number:Time z1_Ui_TitleLength "Title Length: [JS(ksecondsformat.js):%s]" { channel="kaleidescape:player:myzone1:ui#title_length" }
Number:Time z1_Ui_TitleLoc "Title Location: [JS(ksecondsformat.js):%s]" { channel="kaleidescape:player:myzone1:ui#title_loc" }
Number:Time z1_Ui_TitleLength "Title Length: [%s]" { channel="kaleidescape:player:myzone1:ui#title_length" }
Number:Time z1_Ui_TitleLoc "Title Location: [%s]" { channel="kaleidescape:player:myzone1:ui#title_loc" }
DateTime z1_Ui_TitleEndTime "Title End Time: [%s]" { channel="kaleidescape:player:myzone1:ui#endtime" }
Number z1_Ui_ChapterNum "Chapter Number: [%s]" { channel="kaleidescape:player:myzone1:ui#chapter_num" }
Number:Time z1_Ui_ChapterLength "Chapter Length: [JS(ksecondsformat.js):%s]" { channel="kaleidescape:player:myzone1:ui#chapter_length" }
Number:Time z1_Ui_ChapterLoc "Chapter Location: [JS(ksecondsformat.js):%s]" { channel="kaleidescape:player:myzone1:ui#chapter_loc" }
Number:Time z1_Ui_ChapterLength "Chapter Length: [%s]" { channel="kaleidescape:player:myzone1:ui#chapter_length" }
Number:Time z1_Ui_ChapterLoc "Chapter Location: [%s]" { channel="kaleidescape:player:myzone1:ui#chapter_loc" }
String z1_Ui_MovieMediaType "Media Type: [%s]" { channel="kaleidescape:player:myzone1:ui#movie_media_type" }
String z1_Ui_MovieLocation "Movie Location: [%s]" { channel="kaleidescape:player:myzone1:ui#movie_location" }
String z1_Ui_AspectRatio "Aspect Ratio: [%s]" { channel="kaleidescape:player:myzone1:ui#aspect_ratio" }
@@ -204,8 +204,8 @@ String z1_Music_Artist "Artist: [%s]" { channel="kaleidescape:player:myzone1:mus
String z1_Music_Album "Album: [%s]" { channel="kaleidescape:player:myzone1:music#album" }
String z1_Music_PlayMode "Play Mode: [%s]" { channel="kaleidescape:player:myzone1:music#play_mode" }
String z1_Music_PlaySpeed "Play Speed: [%s]" { channel="kaleidescape:player:myzone1:music#play_speed" }
Number:Time z1_Music_TrackLength "Track Length: [JS(ksecondsformat.js):%s]" { channel="kaleidescape:player:myzone1:music#track_length" }
Number:Time z1_Music_TrackPosition "Track Position: [JS(ksecondsformat.js):%s]" { channel="kaleidescape:player:myzone1:music#track_position" }
Number:Time z1_Music_TrackLength "Track Length: [%s]" { channel="kaleidescape:player:myzone1:music#track_length" }
Number:Time z1_Music_TrackPosition "Track Position: [%s]" { channel="kaleidescape:player:myzone1:music#track_position" }
Number z1_Music_TrackProgress "Track Progress: [%s %%]" { channel="kaleidescape:player:myzone1:music#track_progress" }
String z1_Music_Title "Music Title Raw: [%s]" { channel="kaleidescape:player:myzone1:music#title" }
String z1_Music_TrackHandle "Track Handle: [%s]" { channel="kaleidescape:player:myzone1:music#track_handle" }
@@ -221,7 +221,7 @@ String z1_Detail_CoverUrl "[%s]" { channel="kaleidescape:player:myzone1:detail#c
String z1_Detail_HiresCoverUrl "[%s]" { channel="kaleidescape:player:myzone1:detail#hires_cover_url" }
String z1_Detail_Rating "Rating: [%s]" { channel="kaleidescape:player:myzone1:detail#rating" }
String z1_Detail_Year "Year: [%s]" { channel="kaleidescape:player:myzone1:detail#year" }
Number:Time z1_Detail_RunningTime "Running Time: [JS(ksecondsformat.js):%s]" { channel="kaleidescape:player:myzone1:detail#running_time" }
Number:Time z1_Detail_RunningTime "Running Time: [%s]" { channel="kaleidescape:player:myzone1:detail#running_time" }
String z1_Detail_Actors "Actors: [%s]" { channel="kaleidescape:player:myzone1:detail#actors" }
String z1_Detail_Directors "Directors: [%s]" { channel="kaleidescape:player:myzone1:detail#directors" }
String z1_Detail_Artist "Artist: [%s]" { channel="kaleidescape:player:myzone1:detail#artist" }
@@ -236,30 +236,6 @@ String z1_Detail_DiscLocation "Disc Location: [%s]" { channel="kaleidescape:play
String z1_MovieSearch "Movie Search"
```
### `ksecondsformat.js` Example
```javascript
(function(timestamp) {
var totalSeconds = Date.parse(timestamp) / 1000
if (isNaN(totalSeconds)) {
return '-';
} else {
hours = Math.floor(totalSeconds / 3600);
totalSeconds %= 3600;
minutes = Math.floor(totalSeconds / 60);
seconds = totalSeconds % 60;
if ( minutes < 10 ) {
minutes = '0' + minutes;
}
if ( seconds < 10 ) {
seconds = '0' + seconds;
}
return hours + ':' + minutes + ':' + seconds;
}
})(input)
```
### `kaleidescape.sitemap` Example
```perl
@@ -10,6 +10,7 @@
<description>
A Kaleidescape Movie Player (KPlayer, M Class [M300, M500, M700] or Cinema One 1st Gen)
</description>
<semantic-equipment-tag>MediaPlayer</semantic-equipment-tag>
<channel-groups>
<channel-group id="ui" typeId="ui">
@@ -33,7 +34,7 @@
<property name="Control Protocol ID">unknown</property>
<property name="System Version">unknown</property>
<property name="Protocol Version">unknown</property>
<property name="thingTypeVersion">2</property>
<property name="thingTypeVersion">3</property>
</properties>
<config-description-ref uri="thing-type:kaleidescape:kaleidescapedevice"/>
@@ -45,6 +46,7 @@
<description>
A Kaleidescape Cinema One (2nd Generation) Player
</description>
<semantic-equipment-tag>MediaPlayer</semantic-equipment-tag>
<channel-groups>
<channel-group id="ui" typeId="c1-alto_ui">
@@ -68,7 +70,7 @@
<property name="Control Protocol ID">unknown</property>
<property name="System Version">unknown</property>
<property name="Protocol Version">unknown</property>
<property name="thingTypeVersion">2</property>
<property name="thingTypeVersion">3</property>
</properties>
<config-description-ref uri="thing-type:kaleidescape:kaleidescapedevice"/>
@@ -80,6 +82,7 @@
<description>
A Kaleidescape Alto Player
</description>
<semantic-equipment-tag>MediaPlayer</semantic-equipment-tag>
<channel-groups>
<channel-group id="ui" typeId="c1-alto_ui">
@@ -99,7 +102,7 @@
<property name="Control Protocol ID">unknown</property>
<property name="System Version">unknown</property>
<property name="Protocol Version">unknown</property>
<property name="thingTypeVersion">2</property>
<property name="thingTypeVersion">3</property>
</properties>
<config-description-ref uri="thing-type:kaleidescape:kaleidescapedevice"/>
@@ -111,6 +114,7 @@
<description>
A Kaleidescape Strato Player
</description>
<semantic-equipment-tag>MediaPlayer</semantic-equipment-tag>
<channel-groups>
<channel-group id="ui" typeId="strato_ui">
@@ -130,7 +134,7 @@
<property name="Control Protocol ID">unknown</property>
<property name="System Version">unknown</property>
<property name="Protocol Version">unknown</property>
<property name="thingTypeVersion">2</property>
<property name="thingTypeVersion">3</property>
</properties>
<config-description-ref uri="thing-type:kaleidescape:kaleidescapedevice"/>
@@ -349,6 +353,10 @@
<item-type>String</item-type>
<label>Play Mode</label>
<description>The Current playback mode of the movie</description>
<tags>
<tag>Status</tag>
<tag>Mode</tag>
</tags>
<state readOnly="true"/>
</channel-type>
@@ -370,14 +378,18 @@
<item-type>Number:Time</item-type>
<label>Title Length</label>
<description>The total running time of the currently playing movie</description>
<state readOnly="true" pattern="%d %unit%"/>
<state readOnly="true" pattern="%1$tT"/>
</channel-type>
<channel-type id="title_loc">
<item-type>Number:Time</item-type>
<label>Title Location</label>
<description>The running time elapsed of the currently playing movie</description>
<state readOnly="true" pattern="%d %unit%"/>
<tags>
<tag>Status</tag>
<tag>Duration</tag>
</tags>
<state readOnly="true" pattern="%1$tT"/>
</channel-type>
<channel-type id="endtime">
@@ -389,7 +401,7 @@
<tag>Status</tag>
<tag>Timestamp</tag>
</tags>
<state readOnly="true"/>
<state readOnly="true" pattern="%1$tl:%1$tM %1$tp"/>
</channel-type>
<channel-type id="chapter_num">
@@ -403,14 +415,14 @@
<item-type>Number:Time</item-type>
<label>Chapter Length</label>
<description>The total running time of the current chapter</description>
<state readOnly="true" pattern="%d %unit%"/>
<state readOnly="true" pattern="%1$tT"/>
</channel-type>
<channel-type id="chapter_loc">
<item-type>Number:Time</item-type>
<label>Chapter Location</label>
<description>The running time elapsed of the current chapter</description>
<state readOnly="true" pattern="%d %unit%"/>
<state readOnly="true" pattern="%1$tT"/>
</channel-type>
<channel-type id="movie_media_type">
@@ -643,14 +655,14 @@
<item-type>Number:Time</item-type>
<label>Track Length</label>
<description>The total running time of the current playing track</description>
<state readOnly="true" pattern="%d %unit%"/>
<state readOnly="true" pattern="%1$tT"/>
</channel-type>
<channel-type id="track_position">
<item-type>Number:Time</item-type>
<label>Track Position</label>
<description>The running time elapsed of the current playing track</description>
<state readOnly="true" pattern="%d %unit%"/>
<state readOnly="true" pattern="%1$tT"/>
</channel-type>
<channel-type id="track_progress">
@@ -743,7 +755,7 @@
<item-type>Number:Time</item-type>
<label>Running time</label>
<description>The total running time of the selected item</description>
<state readOnly="true"/>
<state readOnly="true" pattern="%1$tT"/>
</channel-type>
<channel-type id="actors">
@@ -9,6 +9,45 @@
<type>kaleidescape:sendcmd</type>
</add-channel>
</instruction-set>
<instruction-set targetVersion="2">
<add-channel id="endtime" groupIds="ui">
<type>kaleidescape:endtime</type>
</add-channel>
<add-channel id="title" groupIds="music">
<type>kaleidescape:music_title</type>
</add-channel>
</instruction-set>
<instruction-set targetVersion="3">
<update-channel id="play_mode" groupIds="ui">
<type>kaleidescape:movie_play_mode</type>
</update-channel>
<update-channel id="title_length" groupIds="ui">
<type>kaleidescape:title_length</type>
</update-channel>
<update-channel id="title_loc" groupIds="ui">
<type>kaleidescape:title_loc</type>
</update-channel>
<update-channel id="endtime" groupIds="ui">
<type>kaleidescape:endtime</type>
</update-channel>
<update-channel id="chapter_length" groupIds="ui">
<type>kaleidescape:chapter_length</type>
</update-channel>
<update-channel id="chapter_loc" groupIds="ui">
<type>kaleidescape:chapter_loc</type>
</update-channel>
<update-channel id="track_length" groupIds="music">
<type>kaleidescape:track_length</type>
</update-channel>
<update-channel id="track_position" groupIds="music">
<type>kaleidescape:track_position</type>
</update-channel>
<update-channel id="running_time" groupIds="detail">
<type>kaleidescape:running_time</type>
</update-channel>
</instruction-set>
</thing-type>
<thing-type uid="kaleidescape:cinemaone">
@@ -17,6 +56,45 @@
<type>kaleidescape:sendcmd</type>
</add-channel>
</instruction-set>
<instruction-set targetVersion="2">
<add-channel id="endtime" groupIds="c1-alto_ui">
<type>kaleidescape:endtime</type>
</add-channel>
<add-channel id="title" groupIds="music">
<type>kaleidescape:music_title</type>
</add-channel>
</instruction-set>
<instruction-set targetVersion="3">
<update-channel id="play_mode" groupIds="c1-alto_ui">
<type>kaleidescape:movie_play_mode</type>
</update-channel>
<update-channel id="title_length" groupIds="c1-alto_ui">
<type>kaleidescape:title_length</type>
</update-channel>
<update-channel id="title_loc" groupIds="c1-alto_ui">
<type>kaleidescape:title_loc</type>
</update-channel>
<update-channel id="endtime" groupIds="c1-alto_ui">
<type>kaleidescape:endtime</type>
</update-channel>
<update-channel id="chapter_length" groupIds="c1-alto_ui">
<type>kaleidescape:chapter_length</type>
</update-channel>
<update-channel id="chapter_loc" groupIds="c1-alto_ui">
<type>kaleidescape:chapter_loc</type>
</update-channel>
<update-channel id="track_length" groupIds="music">
<type>kaleidescape:track_length</type>
</update-channel>
<update-channel id="track_position" groupIds="music">
<type>kaleidescape:track_position</type>
</update-channel>
<update-channel id="running_time" groupIds="detail">
<type>kaleidescape:running_time</type>
</update-channel>
</instruction-set>
</thing-type>
<thing-type uid="kaleidescape:alto">
@@ -25,6 +103,36 @@
<type>kaleidescape:sendcmd</type>
</add-channel>
</instruction-set>
<instruction-set targetVersion="2">
<add-channel id="endtime" groupIds="c1-alto_ui">
<type>kaleidescape:endtime</type>
</add-channel>
</instruction-set>
<instruction-set targetVersion="3">
<update-channel id="play_mode" groupIds="c1-alto_ui">
<type>kaleidescape:movie_play_mode</type>
</update-channel>
<update-channel id="title_length" groupIds="c1-alto_ui">
<type>kaleidescape:title_length</type>
</update-channel>
<update-channel id="title_loc" groupIds="c1-alto_ui">
<type>kaleidescape:title_loc</type>
</update-channel>
<update-channel id="endtime" groupIds="c1-alto_ui">
<type>kaleidescape:endtime</type>
</update-channel>
<update-channel id="chapter_length" groupIds="c1-alto_ui">
<type>kaleidescape:chapter_length</type>
</update-channel>
<update-channel id="chapter_loc" groupIds="c1-alto_ui">
<type>kaleidescape:chapter_loc</type>
</update-channel>
<update-channel id="running_time" groupIds="detail">
<type>kaleidescape:running_time</type>
</update-channel>
</instruction-set>
</thing-type>
<thing-type uid="kaleidescape:strato">
@@ -33,44 +141,36 @@
<type>kaleidescape:sendcmd</type>
</add-channel>
</instruction-set>
</thing-type>
<thing-type uid="kaleidescape:player">
<instruction-set targetVersion="2">
<add-channel id="endtime" groupIds="ui">
<type>kaleidescape:endtime</type>
</add-channel>
<add-channel id="title" groupIds="music">
<type>kaleidescape:music_title</type>
</add-channel>
</instruction-set>
</thing-type>
<thing-type uid="kaleidescape:cinemaone">
<instruction-set targetVersion="2">
<add-channel id="endtime" groupIds="c1-alto_ui">
<type>kaleidescape:endtime</type>
</add-channel>
<add-channel id="title" groupIds="music">
<type>kaleidescape:music_title</type>
</add-channel>
</instruction-set>
</thing-type>
<thing-type uid="kaleidescape:alto">
<instruction-set targetVersion="2">
<add-channel id="endtime" groupIds="c1-alto_ui">
<type>kaleidescape:endtime</type>
</add-channel>
</instruction-set>
</thing-type>
<thing-type uid="kaleidescape:strato">
<instruction-set targetVersion="2">
<add-channel id="endtime" groupIds="strato_ui">
<type>kaleidescape:endtime</type>
</add-channel>
</instruction-set>
<instruction-set targetVersion="3">
<update-channel id="play_mode" groupIds="strato_ui">
<type>kaleidescape:movie_play_mode</type>
</update-channel>
<update-channel id="title_length" groupIds="strato_ui">
<type>kaleidescape:title_length</type>
</update-channel>
<update-channel id="title_loc" groupIds="strato_ui">
<type>kaleidescape:title_loc</type>
</update-channel>
<update-channel id="endtime" groupIds="strato_ui">
<type>kaleidescape:endtime</type>
</update-channel>
<update-channel id="chapter_length" groupIds="strato_ui">
<type>kaleidescape:chapter_length</type>
</update-channel>
<update-channel id="chapter_loc" groupIds="strato_ui">
<type>kaleidescape:chapter_loc</type>
</update-channel>
<update-channel id="running_time" groupIds="detail">
<type>kaleidescape:running_time</type>
</update-channel>
</instruction-set>
</thing-type>
</update:update-descriptions>