Changeset 218
- Timestamp:
- 2015-07-26 10:22:17 (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/I_Sonos1.xml ¶
r216 r218 8 8 local MSG_CLASS = "Sonos" 9 9 10 local PLUGIN_VERSION = "1. 3"10 local PLUGIN_VERSION = "1.4 (dev)" 11 11 12 12 local DEBUG_MODE = false … … 310 310 end 311 311 312 local function getAttribute(xml, tag, attribute) 313 return xml:match("<"..tag.."%s?.-%s"..attribute..'="([^"]+)"[^>]->') 314 end 315 316 local function testParsing() 317 local coordinator, item, item2, id, zoneName, invisible, channelMapSet, isZoneBridge, location, HTSatChanMapSet 318 local tag = "ZoneGroup" 319 local subtag = "ZoneGroupMember" 320 for coordinator, item in groupsState:gmatch("<"..tag..'%sCoordinator="([^"]-)"[^>]->(.-)</'..tag..'>') do 321 log("testParsing: group coordinator=" .. coordinator) 322 for item2 in item:gmatch("(<"..subtag.."%s?[^>]->)") do 323 id = getAttribute(item2, subtag, "UUID") 324 zoneName = getAttribute(item2, subtag, "ZoneName") 325 invisible = getAttribute(item2, subtag, "Invisible") 326 channelMapSet = getAttribute(item2, subtag, "ChannelMapSet") 327 isZoneBridge = getAttribute(item2, subtag, "IsZoneBridge") 328 location = getAttribute(item2, subtag, "Location") 329 HTSatChanMapSet = getAttribute(item2, subtag, "HTSatChanMapSet") 330 log("testParsing: group member id=" .. id .. " zoneName=" .. zoneName .. " invisible=" .. (invisible or "nil") .. " isZoneBridge=" .. (isZoneBridge or "nil") .. " channelMapSet=" .. (channelMapSet or "nil") .. " HTSatChanMapSet=" .. (HTSatChanMapSet or "nil") .. " location=" .. (location or "nil")) 331 end 332 end 333 end 334 312 335 local function getZoneNameFromUUID(uuid) 313 336 local result = nil … … 317 340 local found = false 318 341 for coordinator, item in groupsState:gmatch("<"..tag..'%sCoordinator="([^"]-)"[^>]->(.-)</'..tag..'>') do 319 for item2 in item:gmatch("(<"..subtag.."%s .-/>)") do320 id = item2:match("<"..subtag..'%s?.-%sUUID="([^"]+)".-/>')342 for item2 in item:gmatch("(<"..subtag.."%s?[^>]->)") do 343 id = getAttribute(item2, subtag, "UUID") 321 344 if (id == uuid) then 322 result = item2:match("<"..subtag..'%s?.-%sZoneName="([^"]+)".-/>')345 result = getAttribute(item2, subtag, "ZoneName") 323 346 found = true 324 347 break … … 339 362 local found = false 340 363 for coordinator, item in groupsState:gmatch("<"..tag..'%sCoordinator="([^"]-)"[^>]->(.-)</'..tag..'>') do 341 for item2 in item:gmatch("(<"..subtag.."%s .-/>)") do342 zoneName = item2:match("<"..subtag..'%s?.-%sZoneName="([^"]+)".-/>')343 invisible = item2:match("<"..subtag..'%s?.-%sInvisible="([^"]+)".-/>')344 channelMapSet = item2:match("<"..subtag..'%s?.-%sChannelMapSet="([^"]+)".-/>')364 for item2 in item:gmatch("(<"..subtag.."%s?[^>]->)") do 365 zoneName = getAttribute(item2, subtag, "ZoneName") 366 invisible = getAttribute(item2, subtag, "Invisible") 367 channelMapSet = getAttribute(item2, subtag, "ChannelMapSet") 345 368 if (zoneName == name and (channelMapSet == nil or invisible == "1")) then 346 result = item2:match("<"..subtag..'%s?.-%sUUID="([^"]+)".-/>')369 result = getAttribute(item2, subtag, "UUID") 347 370 found = true 348 371 break … … 363 386 local found = false 364 387 for coordinator, item in groupsState:gmatch("<"..tag..'%sCoordinator="([^"]-)"[^>]->(.-)</'..tag..'>') do 365 for item2 in item:gmatch("(<"..subtag.."%s.-/>)") do366 id = item2:match("<"..subtag..'%s?.-%sUUID="([^"]+)".-/>')388 for item2 in item:gmatch("(<"..subtag.."%s?[^>]->)") do 389 id = getAttribute(item2, subtag, "UUID") 367 390 if (id == uuid) then 368 location = item2:match("<"..subtag..'%s?.-%Location="([^"]+)".-/>')391 location = getAttribute(item2, subtag, "Location") 369 392 if (location ~= nil) then 370 393 result = location:match("http://(.-):.+") … … 580 603 for coordinator, item in groupsState:gmatch("<"..tag..'%sCoordinator="([^"]-)"[^>]->(.-)</'..tag..'>') do 581 604 members = "" 582 for item2 in item:gmatch("(<"..subtag.."%s .-/>)") do583 id = item2:match("<"..subtag..'%s?.-%sUUID="([^"]+)".-/>')605 for item2 in item:gmatch("(<"..subtag.."%s?[^>]->)") do 606 id = getAttribute(item2, subtag, "UUID") 584 607 if (id ~= nil) then 585 608 if (members ~= "") then … … 607 630 local subtag = "ZoneGroupMember" 608 631 for coordinator, item in groupsState:gmatch("<"..tag..'%sCoordinator="([^"]-)"[^>]->(.-)</'..tag..'>') do 609 for item2 in item:gmatch("(<"..subtag.."%s .-/>)") do610 id = item2:match("<"..subtag..'%s?.-%sUUID="([^"]+)".-/>')611 invisible = item2:match("<"..subtag..'%s?.-%sInvisible="([^"]+)".-/>')612 channelMapSet = item2:match("<"..subtag..'%s?.-%sChannelMapSet="([^"]+)".-/>')613 isZoneBridge = item2:match("<"..subtag..'%s?.-%sIsZoneBridge="([^"]+)".-/>')632 for item2 in item:gmatch("(<"..subtag.."%s?[^>]->)") do 633 id = getAttribute(item2, subtag, "UUID") 634 invisible = getAttribute(item2, subtag, "Invisible") 635 channelMapSet = getAttribute(item2, subtag, "ChannelMapSet") 636 isZoneBridge = getAttribute(item2, subtag, "IsZoneBridge") 614 637 if (id ~= nil and isZoneBridge ~= "1" and (channelMapSet == nil or invisible == "1")) then 615 638 if (members ~= "") then -
TabularUnified trunk/J_Sonos1.js ¶
r212 r218 400 400 [ Sonos.AVTRANSPORT_SID, "CurrentTrackURI" ], 401 401 [ Sonos.AVTRANSPORT_SID, "CurrentTrackMetaData" ], 402 [ Sonos.ZONEGROUPTOPOLOGY_SID, "ZoneGroupState" ], 402 403 [ Sonos.SONOS_SID, 'SonosServicesKeys' ] ]; 403 404 html += '<table border="1">';
Note: See TracChangeset
for help on using the changeset viewer.