[samsungtv] fix input change bug (#16787)

Signed-off-by: Nick Waterton <n.waterton@outlook.com>
This commit is contained in:
Nick Waterton 2024-05-22 17:45:00 -03:00 committed by GitHub
parent 1ce305b3e8
commit 7394ba0603
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -342,10 +342,11 @@ public class MainTVServerService implements UpnpIOParticipant, SamsungTvService
// NodeList doesn't have a stream, so do this
sources = Optional.of(updateResourceState("GetSourceList")).filter(a -> "OK".equals(a.get("Result")))
.map(a -> a.get("SourceList")).flatMap(xml -> Utils.loadXMLFromString(xml, host))
.map(a -> a.getDocumentElement()).map(a -> a.getElementsByTagName("Source"))
.map(a -> a.getDocumentElement()).map(
a -> a.getElementsByTagName("Source"))
.map(nList -> IntStream.range(0, nList.getLength()).boxed().map(i -> (Element) nList.item(i))
.collect(Collectors.toMap(a -> getFirstNodeValue(a, "SourceType", ""),
a -> getFirstNodeValue(a, "ID", ""))))
a -> getFirstNodeValue(a, "ID", ""), (key1, key2) -> key2)))
.orElse(Map.of());
}