From 1c322e38327db2d5cf99cfb0cbfc2199a54691d9 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Fri, 10 Feb 2006 11:42:57 -0800 Subject: [PATCH] expand the Storage* stuff to include the required attributes.. [git-p4: depot-paths = "//depot/": change = 739] --- DIDLLite.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/DIDLLite.py b/DIDLLite.py index 1fd98ee..10cd383 100644 --- a/DIDLLite.py +++ b/DIDLLite.py @@ -267,12 +267,57 @@ class MovieGenre(Genre): class StorageSystem(Container): klass = Container.klass + '.storageSystem' + total = -1 + used = -1 + free = -1 + maxpartition = -1 + medium = 'UNKNOWN' + + def toElement(self): + + root = Container.toElement(self) + + SubElement(root, 'upnp:storageTotal').text = str(self.total) + SubElement(root, 'upnp:storageUsed').text = str(self.used) + SubElement(root, 'upnp:storageFree').text = str(self.free) + SubElement(root, 'upnp:storageMaxPartition').text = str(self.maxpartition) + SubElement(root, 'upnp:storageMedium').text = self.medium + + return root + class StorageVolume(Container): klass = Container.klass + '.storageVolume' + total = -1 + used = -1 + free = -1 + medium = 'UNKNOWN' + + def toElement(self): + + root = Container.toElement(self) + + SubElement(root, 'upnp:storageTotal').text = str(self.total) + SubElement(root, 'upnp:storageUsed').text = str(self.used) + SubElement(root, 'upnp:storageFree').text = str(self.free) + SubElement(root, 'upnp:storageMedium').text = self.medium + + return root + class StorageFolder(Container): klass = Container.klass + '.storageFolder' + used = -1 + + def toElement(self): + + root = Container.toElement(self) + + if self.used is not None: + SubElement(root, 'upnp:storageUsed').text = str(self.used) + + return root + class DIDLElement(_ElementInterface): def __init__(self): _ElementInterface.__init__(self, 'DIDL-Lite', {})