Browse Source

clean up searchClass and createClass

[git-p4: depot-paths = "//depot/": change = 1350]
main
John-Mark Gurney 15 years ago
parent
commit
e3e8457d4e
1 changed files with 12 additions and 8 deletions
  1. +12
    -8
      DIDLLite.py

+ 12
- 8
DIDLLite.py View File

@@ -394,6 +394,16 @@ class Container(Object, list):
self.updateID = (self.updateID + 1) % (1l << 32)
Container.didUpdate(self.cd['0'])

def _addSet(self, e, items):
if items is not None:
if not isinstance(items, (list, tuple)):
items = [ items ]
for i in items:
el = SubElement(root, e)
el.text = i
# XXX - how to specify?
el.attrib['includeDerived'] = '1'
def toElement(self):

root = Object.toElement(self)
@@ -403,14 +413,8 @@ class Container(Object, list):
if self.childCount:
root.attrib['childCount'] = str(self.childCount)

if self.createClass is not None:
SubElement(root, 'upnp:createclass').text = self.createClass

if self.searchClass is not None:
if not isinstance(self.searchClass, (list, tuple)):
self.searchClass = ['searchClass']
for i in searchClass:
SubElement(root, 'upnp:searchclass').text = i
self._addSet('upnp:createclass', self.createClass)
self._addSet('upnp:searchclass', self.searchClass)

if self.searchable is not None:
root.attrib['searchable'] = str(self.searchable)


Loading…
Cancel
Save