Fix clearing Now Playing channels (#17185)

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
Jacob Laursen 2024-08-01 12:32:11 +02:00 committed by Ciprian Pascu
parent a6022133c4
commit 7c9bb22e0e

View File

@ -19,6 +19,7 @@ import java.math.BigDecimal;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
@ -340,18 +341,9 @@ public class DenonMarantzHttpConnector extends DenonMarantzConnector {
return;
}
CommandRx titleInfo = response.getCommands().get(0);
String artist = titleInfo.getText("artist");
if (artist != null) {
state.setNowPlayingArtist(artist);
}
String album = titleInfo.getText("album");
if (album != null) {
state.setNowPlayingAlbum(album);
}
String track = titleInfo.getText("track");
if (track != null) {
state.setNowPlayingTrack(track);
}
state.setNowPlayingArtist(Objects.requireNonNullElse(titleInfo.getText("artist"), ""));
state.setNowPlayingAlbum(Objects.requireNonNullElse(titleInfo.getText("album"), ""));
state.setNowPlayingTrack(Objects.requireNonNullElse(titleInfo.getText("track"), ""));
} catch (HttpCommunicationException e) {
logger.debug("Failed to update display info: {}", e.getMessage());
}