fix(android): DIDL-Lite restricted=true / id=-1 so Sonos accepts metadata
android / Build + lint + test (push) Failing after 1m33s

This commit is contained in:
2026-06-04 00:59:31 -04:00
parent c5b326c620
commit 3085d6f409
@@ -204,13 +204,18 @@ class AVTransportClient(
}
private fun buildDidlLite(uri: String, mime: String, title: String): String {
// Sonos firmware accepts boolean-style restricted ("true"/"false") only
// and rejects "1"/"0" silently; if it can't parse our DIDL it regenerates
// its own with generic class object.item, no title, and the URL query
// string as the displayed name (logcat 2026-06-04 confirmed). Match the
// SoCo convention which the firmware definitely accepts.
val safeTitle = title.ifBlank { "Minstrel" }
return buildString {
append("<DIDL-Lite ")
append("xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\" ")
append("xmlns:dc=\"http://purl.org/dc/elements/1.1/\" ")
append("xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\">")
append("<item id=\"0\" parentID=\"-1\" restricted=\"1\">")
append("<item id=\"-1\" parentID=\"-1\" restricted=\"true\">")
append("<dc:title>").append(xmlEscape(safeTitle)).append("</dc:title>")
append("<upnp:class>object.item.audioItem.musicTrack</upnp:class>")
append("<res protocolInfo=\"http-get:*:").append(xmlEscape(mime))