mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[kaleidescape] Add movie end time and music title channels (#17423)
* Add movie end time and music end title channels Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
08dce8c477
commit
34b7ca671f
@ -71,6 +71,7 @@ The following channels are available:
|
||||
| ui#title_num | Number | The current movie title number that is playing |
|
||||
| ui#title_length | Number:Time | The total running time of the currently playing movie (seconds) |
|
||||
| ui#title_loc | Number:Time | The running time elapsed of the currently playing movie (seconds) |
|
||||
| ui#endtime | DateTime | The date/time when the currently playing movie will end (timestamp) |
|
||||
| ui#chapter_num | Number | The current chapter number of the movie that is playing |
|
||||
| ui#chapter_length | Number:Time | The total running time of the current chapter (seconds) |
|
||||
| ui#chapter_loc | Number:Time | The running time elapsed of the current chapter |
|
||||
@ -105,6 +106,7 @@ The following channels are available:
|
||||
| music#track | String | The name of the currently playing track |
|
||||
| music#artist | String | The name of the currently playing artist |
|
||||
| music#album | String | The name of the currently playing album |
|
||||
| music#title | String | The raw output from the MUSIC_TITLE api response for use in rules that require track, artist and album changes in one update |
|
||||
| music#play_mode | String | The current playback mode of the music |
|
||||
| music#play_speed | String | The speed of playback scanning |
|
||||
| music#track_length | Number:Time | The total running time of the current playing track (seconds) |
|
||||
@ -162,6 +164,7 @@ String z1_Ui_PlaySpeed "Play Speed: [%s]" { channel="kaleidescape:player:myzone1
|
||||
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" }
|
||||
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" }
|
||||
@ -203,6 +206,7 @@ String z1_Music_PlaySpeed "Play Speed: [%s]" { channel="kaleidescape:player:myzo
|
||||
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 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" }
|
||||
String z1_Music_AlbumHandle "Album Handle: [%s]" { channel="kaleidescape:player:myzone1:music#album_handle" }
|
||||
String z1_Music_NowplayHandle "Now Playing Handle: [%s]" { channel="kaleidescape:player:myzone1:music#nowplay_handle" }
|
||||
@ -291,6 +295,7 @@ sitemap kaleidescape label="Kaleidescape" {
|
||||
Text item=z1_Ui_TitleNum icon="video"
|
||||
Text item=z1_Ui_TitleLength icon="time"
|
||||
Text item=z1_Ui_TitleLoc icon="time"
|
||||
Text item=z1_Ui_TitleEndTime icon="time"
|
||||
Text item=z1_Ui_MovieMediaType icon="colorwheel"
|
||||
Text item=z1_Ui_ChapterNum icon="video"
|
||||
Text item=z1_Ui_ChapterLength icon="time"
|
||||
@ -334,6 +339,7 @@ sitemap kaleidescape label="Kaleidescape" {
|
||||
Text item=z1_Music_TrackLength icon="time"
|
||||
Text item=z1_Music_TrackPosition icon="time"
|
||||
Text item=z1_Music_TrackProgress icon="time"
|
||||
Text item=z1_Music_Title icon="zoom"
|
||||
Text item=z1_Music_TrackHandle icon="zoom"
|
||||
Text item=z1_Music_AlbumHandle icon="zoom"
|
||||
Text item=z1_Music_NowplayHandle icon="zoom"
|
||||
|
@ -56,6 +56,7 @@ public class KaleidescapeBindingConstants {
|
||||
public static final String TITLE_NUM = "ui#title_num";
|
||||
public static final String TITLE_LENGTH = "ui#title_length";
|
||||
public static final String TITLE_LOC = "ui#title_loc";
|
||||
public static final String ENDTIME = "ui#endtime";
|
||||
public static final String CHAPTER_NUM = "ui#chapter_num";
|
||||
public static final String CHAPTER_LENGTH = "ui#chapter_length";
|
||||
public static final String CHAPTER_LOC = "ui#chapter_loc";
|
||||
@ -91,6 +92,7 @@ public class KaleidescapeBindingConstants {
|
||||
public static final String MUSIC_TRACK = "music#track";
|
||||
public static final String MUSIC_ARTIST = "music#artist";
|
||||
public static final String MUSIC_ALBUM = "music#album";
|
||||
public static final String MUSIC_TITLE_RAW = "music#title";
|
||||
public static final String MUSIC_PLAY_MODE = "music#play_mode";
|
||||
public static final String MUSIC_PLAY_SPEED = "music#play_speed";
|
||||
public static final String MUSIC_TRACK_LENGTH = "music#track_length";
|
||||
|
@ -500,6 +500,7 @@ public class KaleidescapeHandler extends BaseThingHandler implements Kaleidescap
|
||||
case TITLE_NUM:
|
||||
case TITLE_LENGTH:
|
||||
case TITLE_LOC:
|
||||
case ENDTIME:
|
||||
case CHAPTER_NUM:
|
||||
case CHAPTER_LENGTH:
|
||||
case CHAPTER_LOC:
|
||||
@ -565,6 +566,7 @@ public class KaleidescapeHandler extends BaseThingHandler implements Kaleidescap
|
||||
case MUSIC_TRACK:
|
||||
case MUSIC_ARTIST:
|
||||
case MUSIC_ALBUM:
|
||||
case MUSIC_TITLE_RAW:
|
||||
case MUSIC_TRACK_HANDLE:
|
||||
case MUSIC_ALBUM_HANDLE:
|
||||
case MUSIC_NOWPLAY_HANDLE:
|
||||
|
@ -17,6 +17,7 @@ import static org.eclipse.jetty.http.HttpStatus.OK_200;
|
||||
import static org.openhab.binding.kaleidescape.internal.KaleidescapeBindingConstants.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
@ -29,6 +30,7 @@ import org.openhab.binding.kaleidescape.internal.KaleidescapeBindingConstants;
|
||||
import org.openhab.binding.kaleidescape.internal.KaleidescapeException;
|
||||
import org.openhab.binding.kaleidescape.internal.communication.KaleidescapeFormatter;
|
||||
import org.openhab.binding.kaleidescape.internal.communication.KaleidescapeStatusCodes;
|
||||
import org.openhab.core.library.types.DateTimeType;
|
||||
import org.openhab.core.library.types.DecimalType;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.library.types.PercentType;
|
||||
@ -116,11 +118,15 @@ public enum KaleidescapeMessageHandler {
|
||||
|
||||
handler.updateChannel(TITLE_NUM, new DecimalType(Integer.parseInt(matcher.group(3))));
|
||||
|
||||
handler.updateChannel(TITLE_LENGTH,
|
||||
new QuantityType<>(Integer.parseInt(matcher.group(4)), handler.apiSecondUnit));
|
||||
final int titleLength = Integer.parseInt(matcher.group(4));
|
||||
final int titleLoc = Integer.parseInt(matcher.group(5));
|
||||
|
||||
handler.updateChannel(TITLE_LOC,
|
||||
new QuantityType<>(Integer.parseInt(matcher.group(5)), handler.apiSecondUnit));
|
||||
handler.updateChannel(TITLE_LENGTH, new QuantityType<>(titleLength, handler.apiSecondUnit));
|
||||
|
||||
handler.updateChannel(TITLE_LOC, new QuantityType<>(titleLoc, handler.apiSecondUnit));
|
||||
|
||||
handler.updateChannel(ENDTIME, titleLength < 1 ? UnDefType.UNDEF
|
||||
: new DateTimeType(ZonedDateTime.now().plusSeconds(titleLength - titleLoc)));
|
||||
|
||||
handler.updateChannel(CHAPTER_NUM, new DecimalType(Integer.parseInt(matcher.group(6))));
|
||||
|
||||
@ -270,6 +276,10 @@ public enum KaleidescapeMessageHandler {
|
||||
// first replace delimited : in track/artist/album name with ||, fix it later in formatString()
|
||||
Matcher matcher = p.matcher(message.replace("\\:", "||"));
|
||||
if (matcher.find()) {
|
||||
// if not an empty message, the colon delimiters in raw MUSIC_TITLE message are changed to pipe
|
||||
handler.updateChannel(MUSIC_TITLE_RAW, ":::::".equals(matcher.group(0)) ? UnDefType.NULL
|
||||
: new StringType(KaleidescapeFormatter.formatString(matcher.group(0).replace(":", "|"))));
|
||||
|
||||
handler.updateChannel(MUSIC_TRACK,
|
||||
new StringType(KaleidescapeFormatter.formatString(matcher.group(1))));
|
||||
|
||||
|
@ -116,6 +116,8 @@ channel-type.kaleidescape.directors.label = Directors
|
||||
channel-type.kaleidescape.directors.description = A list of directors of the selected Movie
|
||||
channel-type.kaleidescape.disc_location.label = Disc Location
|
||||
channel-type.kaleidescape.disc_location.description = Indicates where the disc for the selected item is currently residing in the system (ie Vault, Tray, etc.)
|
||||
channel-type.kaleidescape.endtime.label = Title End Time
|
||||
channel-type.kaleidescape.endtime.description = The date/time when the currently playing movie will end
|
||||
channel-type.kaleidescape.genres.label = Genres
|
||||
channel-type.kaleidescape.genres.description = A list of genres of the selected item
|
||||
channel-type.kaleidescape.highlighted_selection.label = Highlighted Selection
|
||||
@ -138,6 +140,8 @@ channel-type.kaleidescape.music_play_mode.label = Play Mode
|
||||
channel-type.kaleidescape.music_play_mode.description = The current playback mode of the music
|
||||
channel-type.kaleidescape.music_play_speed.label = Play Speed
|
||||
channel-type.kaleidescape.music_play_speed.description = The speed of playback scanning
|
||||
channel-type.kaleidescape.music_title.label = Music Title
|
||||
channel-type.kaleidescape.music_title.description = The raw output from the MUSIC_TITLE api response
|
||||
channel-type.kaleidescape.nowplay_handle.label = Now Playing Handle
|
||||
channel-type.kaleidescape.nowplay_handle.description = The handle of the current now playing list
|
||||
channel-type.kaleidescape.random.label = Random
|
||||
|
@ -33,7 +33,7 @@
|
||||
<property name="Control Protocol ID">unknown</property>
|
||||
<property name="System Version">unknown</property>
|
||||
<property name="Protocol Version">unknown</property>
|
||||
<property name="thingTypeVersion">1</property>
|
||||
<property name="thingTypeVersion">2</property>
|
||||
</properties>
|
||||
|
||||
<config-description-ref uri="thing-type:kaleidescape:kaleidescapedevice"/>
|
||||
@ -68,7 +68,7 @@
|
||||
<property name="Control Protocol ID">unknown</property>
|
||||
<property name="System Version">unknown</property>
|
||||
<property name="Protocol Version">unknown</property>
|
||||
<property name="thingTypeVersion">1</property>
|
||||
<property name="thingTypeVersion">2</property>
|
||||
</properties>
|
||||
|
||||
<config-description-ref uri="thing-type:kaleidescape:kaleidescapedevice"/>
|
||||
@ -99,7 +99,7 @@
|
||||
<property name="Control Protocol ID">unknown</property>
|
||||
<property name="System Version">unknown</property>
|
||||
<property name="Protocol Version">unknown</property>
|
||||
<property name="thingTypeVersion">1</property>
|
||||
<property name="thingTypeVersion">2</property>
|
||||
</properties>
|
||||
|
||||
<config-description-ref uri="thing-type:kaleidescape:kaleidescapedevice"/>
|
||||
@ -130,7 +130,7 @@
|
||||
<property name="Control Protocol ID">unknown</property>
|
||||
<property name="System Version">unknown</property>
|
||||
<property name="Protocol Version">unknown</property>
|
||||
<property name="thingTypeVersion">1</property>
|
||||
<property name="thingTypeVersion">2</property>
|
||||
</properties>
|
||||
|
||||
<config-description-ref uri="thing-type:kaleidescape:kaleidescapedevice"/>
|
||||
@ -150,6 +150,7 @@
|
||||
<channel id="title_num" typeId="title_num"/>
|
||||
<channel id="title_length" typeId="title_length"/>
|
||||
<channel id="title_loc" typeId="title_loc"/>
|
||||
<channel id="endtime" typeId="endtime"/>
|
||||
<channel id="chapter_num" typeId="chapter_num"/>
|
||||
<channel id="chapter_length" typeId="chapter_length"/>
|
||||
<channel id="chapter_loc" typeId="chapter_loc"/>
|
||||
@ -190,6 +191,7 @@
|
||||
<channel id="title_num" typeId="title_num"/>
|
||||
<channel id="title_length" typeId="title_length"/>
|
||||
<channel id="title_loc" typeId="title_loc"/>
|
||||
<channel id="endtime" typeId="endtime"/>
|
||||
<channel id="chapter_num" typeId="chapter_num"/>
|
||||
<channel id="chapter_length" typeId="chapter_length"/>
|
||||
<channel id="chapter_loc" typeId="chapter_loc"/>
|
||||
@ -229,6 +231,7 @@
|
||||
<channel id="title_num" typeId="title_num"/>
|
||||
<channel id="title_length" typeId="title_length"/>
|
||||
<channel id="title_loc" typeId="title_loc"/>
|
||||
<channel id="endtime" typeId="endtime"/>
|
||||
<channel id="chapter_num" typeId="chapter_num"/>
|
||||
<channel id="chapter_length" typeId="chapter_length"/>
|
||||
<channel id="chapter_loc" typeId="chapter_loc"/>
|
||||
@ -267,6 +270,7 @@
|
||||
<channel id="track" typeId="track"/>
|
||||
<channel id="artist" typeId="artist"/>
|
||||
<channel id="album" typeId="album"/>
|
||||
<channel id="title" typeId="music_title"/>
|
||||
<channel id="play_mode" typeId="music_play_mode"/>
|
||||
<channel id="play_speed" typeId="music_play_speed"/>
|
||||
<channel id="track_length" typeId="track_length"/>
|
||||
@ -376,6 +380,18 @@
|
||||
<state readOnly="true" pattern="%d %unit%"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="endtime">
|
||||
<item-type>DateTime</item-type>
|
||||
<label>Title End Time</label>
|
||||
<description>The date/time when the currently playing movie will end</description>
|
||||
<category>Time</category>
|
||||
<tags>
|
||||
<tag>Status</tag>
|
||||
<tag>Timestamp</tag>
|
||||
</tags>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="chapter_num">
|
||||
<item-type>Number</item-type>
|
||||
<label>Chapter Number</label>
|
||||
@ -602,6 +618,13 @@
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="music_title" advanced="true">
|
||||
<item-type>String</item-type>
|
||||
<label>Music Title</label>
|
||||
<description>The raw output from the MUSIC_TITLE api response</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="music_play_mode">
|
||||
<item-type>String</item-type>
|
||||
<label>Play Mode</label>
|
||||
|
@ -35,4 +35,42 @@
|
||||
</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>
|
||||
</thing-type>
|
||||
|
||||
</update:update-descriptions>
|
||||
|
Loading…
Reference in New Issue
Block a user