From ad957f899f08ec4f049b6984ef53ed17512b9815 Mon Sep 17 00:00:00 2001 From: Karel Goderis Date: Mon, 16 Feb 2015 17:11:19 +0100 Subject: [PATCH] Fix small bugs in updateCurrentURIFormatted and updateTrackMetaData Signed-off-by: Karel Goderis --- .../binding/sonos/handler/ZonePlayerHandler.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/handler/ZonePlayerHandler.java b/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/handler/ZonePlayerHandler.java index a18a0ccee35e3..f2aa92eb3371b 100644 --- a/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/handler/ZonePlayerHandler.java +++ b/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/handler/ZonePlayerHandler.java @@ -600,7 +600,7 @@ protected void updateTrackMetaData() { if (currentTrack != null) { - String artist = ""; + String artist = null; if (currentTrack.getAlbumArtist().equals("")) { artist = currentTrack.getCreator(); } else { @@ -608,7 +608,7 @@ protected void updateTrackMetaData() { } String album = currentTrack.getAlbum(); - String title = ""; + String title = null; if(!currentTrack.getTitle().contains("x-sonosapi-stream")) { title = currentTrack.getTitle(); } @@ -616,8 +616,10 @@ protected void updateTrackMetaData() { // update individual variables this.onValueReceived("CurrentArtist", (artist != null) ? artist : "", "AVTransport"); - this.onValueReceived("CurrentTitle", (title != null) ? title : "", - "AVTransport"); + if(title!=null) { + this.onValueReceived("CurrentTitle", (title != null) ? title : "", + "AVTransport"); + } this.onValueReceived("CurrentAlbum", (album != null) ? album : "", "AVTransport"); @@ -635,7 +637,7 @@ protected void updateCurrentURIFormatted() { String coordinator = getCoordinator(); ZonePlayerHandler coordinatorHandler = getHandlerByName(coordinator); - if (coordinatorHandler != null) { + if (coordinatorHandler != null && coordinatorHandler != this) { if(getCurrentURI().contains("x-rincon")) { coordinatorHandler.updateMediaInfo(); }