@@ -89,8 +89,8 @@ class Object(object):
content = property(lambda x: x._content)
needupdate = None # do we update before sending? (for res)
def __init__(self, cd, id, parentID, title, restricted = False,
creator = None, **kwargs):
def __init__(self, cd, id, parentID, title, restricted=False,
creator=None, **kwargs):
self.cd = cd
self.id = id
@@ -297,10 +297,8 @@ class Container(Object, list):
updateID = 0
needupdate = False
def __init__(self, cd, id, parentID, title, restricted = 0,
creator = None, **kwargs):
Object.__init__(self, cd, id, parentID, title, restricted,
creator, **kwargs)
def __init__(self, cd, id, parentID, title, **kwargs):
Object.__init__(self, cd, id, parentID, title, **kwargs)
list.__init__(self)
self.doingUpdate = False
self.oldchildren = {}
@@ -513,10 +511,6 @@ class DIDLElement(_ElementInterface):
self.attrib['xmlns:dc'] = 'http://purl.org/dc/elements/1.1/'
self.attrib['xmlns:upnp'] = 'urn:schemas-upnp-org:metadata-1-0/upnp'
def addContainer(self, id, parentID, title, restricted = False):
e = Container(id, parentID, title, restricted, creator = '')
self.append(e.toElement())
def addItem(self, item):
self.append(item.toElement())
@@ -529,9 +523,9 @@ class DIDLElement(_ElementInterface):
if __name__ == '__main__':
root = DIDLElement()
root.addContainer('0\Movie\\', '0\\', 'Movie')
root.addContainer('0\Music\\', '0\\', 'Music')
root.addContainer('0\Photo\\', '0\\', 'Photo')
root.addContainer('0\OnlineMedia\\', '0\\', 'OnlineMedia')
root.addItem( Container(None, '0\Movie\\', '0\\', 'Movie'))
root.addItem( Container(None, '0\Music\\', '0\\', 'Music'))
root.addItem( Container(None, '0\Photo\\', '0\\', 'Photo'))
root.addItem( Container(None, '0\OnlineMedia\\', '0\\', 'OnlineMedia'))
print tostring(root)