Browse Source

properly generate TotalMatches...

don't delete empty but existing items from being returned, this could
of also hid dirs...  the DSM-520 depends upon the existance of the
last item (that isn't displayed) to decide if there are more items
in the listing...

[git-p4: depot-paths = "//depot/": change = 814]
v0.3
John-Mark Gurney 18 years ago
parent
commit
8eb1aba1b7
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      ContentDirectory.py

+ 9
- 2
ContentDirectory.py View File

@@ -145,13 +145,20 @@ class ContentDirectoryControl(UPnPPublisher, dict):

if BrowseFlag == 'BrowseDirectChildren':
ch = self.getchildren(ObjectID)[StartingIndex: StartingIndex + RequestedCount]
filter(lambda x, d = didl: d.addItem(x) and None, filter(lambda x, s = self: s[x.id].checkUpdate(), ch))
# filter out the ones that don't exist anymore, we need
# to check against None, since some dirs might be empty
# (of valid content) but exist.
ochup = filter(lambda x, s = self:
s[x.id].checkUpdate() is not None, ch)
filter(lambda x, d = didl: d.addItem(x) and None, ochup)
total = len(self.getchildren(ObjectID))
else:
didl.addItem(self[ObjectID])
total = 1

result = {'BrowseResponse': {'Result': didl.toString() ,
'NumberReturned': didl.numItems(),
'TotalMatches': didl.numItems(),
'TotalMatches': total,
'UpdateID': self[ObjectID].updateID }}

#log.msg('Returning: %s' % result)


Loading…
Cancel
Save