Skip to content

Commit

Permalink
[onkyo] bring back Album Art URL channel (openhab#1889)
Browse files Browse the repository at this point in the history
* [onkyo] bring back Album Art URL channel
To be used for UI's that don't support image Itemtype yet

Signed-off-by: Marcel Verpaalen <[email protected]>
  • Loading branch information
marcelrv authored and Ogórek Anatol committed Jul 5, 2017
1 parent c66f6d5 commit fa1e975
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<channel id="listenmode" typeId="listenmode" />
<channel id="playuri" typeId="playuri" />
<channel id="albumArt" typeId="albumArt" />
<channel id="albumArtUrl" typeId="albumArtUrl" />
</channels>
</channel-group-type>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@
<description>Image of cover art of the current song</description>
<state readOnly="true"></state>
</channel-type>
<channel-type id="albumArtUrl" advanced="true">
<item-type>String</item-type>
<label>Album Art Url</label>
<description>Url to the image of cover art of the current song</description>
<state readOnly="true"></state>
</channel-type>
<channel-type id="artist" advanced="true">
<item-type>String</item-type>
<label>Artist</label>
Expand Down
5 changes: 3 additions & 2 deletions addons/binding/org.openhab.binding.onkyo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ The Onkyo AVR supports the following channels (some channels are model specific)
| player#listenmode | Number | Current listening mode e.g. Stereo, 5.1ch Surround,..|
| player#playuri | String | Plays the URI provided to the channel |
| player#albumArt | Image | Image of the current album art of the current song |
| player#albumArtUrl | String | Url to the current album art of the current song |
| netmenu#title | String | Title of the current NET service |
| netmenu#control | String | Control the USB/Net Menu, e.g. Up/Down/Select/Back/PageUp/PageDown/Select[0-9]
| netmenu#selection | Number | The number of the currently selected USB/Net Menu entry (0-9)
Expand Down Expand Up @@ -154,5 +155,5 @@ Here after are the ID values of the input sources:

## Audio Support

+All supported Onkyo AVRs are registered as an audio sink in the framework.
+Audio streams are sent to the `playuri` channel.
+ All supported Onkyo AVRs are registered as an audio sink in the framework.
+ Audio streams are sent to the `playuri` channel.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public class OnkyoBindingConstants {
public final static String CHANNEL_TITLE = "player#title";
public final static String CHANNEL_ALBUM = "player#album";
public static final String CHANNEL_ALBUM_ART = "player#albumArt";
public static final String CHANNEL_ALBUM_ART_URL = "player#albumArtUrl";
public final static String CHANNEL_LISTENMODE = "player#listenmode";
public static final String CHANNEL_PLAY_URI = "player#playuri";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ public void handleCommand(ChannelUID channelUID, Command command) {
handlePlayUri(command);
break;
case CHANNEL_ALBUM_ART:
case CHANNEL_ALBUM_ART_URL:
if (command.equals(RefreshType.REFRESH)) {
sendCommand(EiscpCommand.NETUSB_ALBUM_ART_QUERY);
}
Expand Down Expand Up @@ -538,6 +539,16 @@ private void updateAlbumArt(String data) {
}
onkyoAlbumArt.clearAlbumArt();
}

if (data.startsWith("2-")) {
updateState(CHANNEL_ALBUM_ART_URL, new StringType(data.substring(2, data.length())));
} else if (data.startsWith("n-")) {
updateState(CHANNEL_ALBUM_ART_URL, UnDefType.UNDEF);
} else {
logger.debug("Not supported album art URL type: {}", data.substring(0, 2));
updateState(CHANNEL_ALBUM_ART_URL, UnDefType.UNDEF);
}

}

private void updateNetTitle(String data) {
Expand Down

0 comments on commit fa1e975

Please sign in to comment.