Changeset 218


Ignore:
Timestamp:
2015-07-26 10:22:17 (10 years ago)
Author:
lolodomo
Message:

Fix group management for Playbar

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/I_Sonos1.xml

    r216 r218  
    88  local MSG_CLASS = "Sonos" 
    99 
    10   local PLUGIN_VERSION = "1.3" 
     10  local PLUGIN_VERSION = "1.4 (dev)" 
    1111 
    1212  local DEBUG_MODE = false 
     
    310310  end 
    311311 
     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 
    312335  local function getZoneNameFromUUID(uuid) 
    313336      local result = nil 
     
    317340      local found = false 
    318341      for coordinator, item in groupsState:gmatch("<"..tag..'%sCoordinator="([^"]-)"[^>]->(.-)</'..tag..'>') do 
    319           for item2 in item:gmatch("(<"..subtag.."%s.-/>)") do 
    320               id = item2:match("<"..subtag..'%s?.-%sUUID="([^"]+)".-/>') 
     342          for item2 in item:gmatch("(<"..subtag.."%s?[^>]->)") do 
     343              id = getAttribute(item2, subtag, "UUID") 
    321344              if (id == uuid) then 
    322                   result = item2:match("<"..subtag..'%s?.-%sZoneName="([^"]+)".-/>') 
     345                  result = getAttribute(item2, subtag, "ZoneName") 
    323346                  found = true 
    324347                  break 
     
    339362      local found = false 
    340363      for coordinator, item in groupsState:gmatch("<"..tag..'%sCoordinator="([^"]-)"[^>]->(.-)</'..tag..'>') do 
    341           for item2 in item:gmatch("(<"..subtag.."%s.-/>)") do 
    342               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") 
    345368              if (zoneName == name and (channelMapSet == nil or invisible == "1")) then 
    346                   result = item2:match("<"..subtag..'%s?.-%sUUID="([^"]+)".-/>') 
     369                  result = getAttribute(item2, subtag, "UUID") 
    347370                  found = true 
    348371                  break 
     
    363386      local found = false 
    364387      for coordinator, item in groupsState:gmatch("<"..tag..'%sCoordinator="([^"]-)"[^>]->(.-)</'..tag..'>') do 
    365           for item2 in item:gmatch("(<"..subtag.."%s.-/>)") do 
    366               id = item2:match("<"..subtag..'%s?.-%sUUID="([^"]+)".-/>') 
     388         for item2 in item:gmatch("(<"..subtag.."%s?[^>]->)") do 
     389              id = getAttribute(item2, subtag, "UUID") 
    367390              if (id == uuid) then 
    368                   location = item2:match("<"..subtag..'%s?.-%Location="([^"]+)".-/>') 
     391                  location = getAttribute(item2, subtag, "Location") 
    369392                  if (location ~= nil) then 
    370393                      result = location:match("http://(.-):.+") 
     
    580603      for coordinator, item in groupsState:gmatch("<"..tag..'%sCoordinator="([^"]-)"[^>]->(.-)</'..tag..'>') do 
    581604          members = "" 
    582           for item2 in item:gmatch("(<"..subtag.."%s.-/>)") do 
    583               id = item2:match("<"..subtag..'%s?.-%sUUID="([^"]+)".-/>') 
     605          for item2 in item:gmatch("(<"..subtag.."%s?[^>]->)") do 
     606              id = getAttribute(item2, subtag, "UUID") 
    584607              if (id ~= nil) then 
    585608                  if (members ~= "") then 
     
    607630      local subtag = "ZoneGroupMember" 
    608631      for coordinator, item in groupsState:gmatch("<"..tag..'%sCoordinator="([^"]-)"[^>]->(.-)</'..tag..'>') do 
    609           for item2 in item:gmatch("(<"..subtag.."%s.-/>)") do 
    610               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") 
    614637              if (id ~= nil and isZoneBridge ~= "1" and (channelMapSet == nil or invisible == "1")) then 
    615638                  if (members ~= "") then 
  • TabularUnified trunk/J_Sonos1.js

    r212 r218  
    400400                        [ Sonos.AVTRANSPORT_SID, "CurrentTrackURI" ], 
    401401                        [ Sonos.AVTRANSPORT_SID, "CurrentTrackMetaData" ], 
     402                        [ Sonos.ZONEGROUPTOPOLOGY_SID, "ZoneGroupState" ], 
    402403                        [ Sonos.SONOS_SID, 'SonosServicesKeys' ] ]; 
    403404    html += '<table border="1">'; 
Note: See TracChangeset for help on using the changeset viewer.