Fix clearing Now Playing channels (#17185)

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2024-08-01 12:32:11 +02:00 committed by GitHub
parent 013e04fd2d
commit 87eb3a5feb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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