Browse Source

include object in result buffer if it exists...

don't repr the return value, the dict containing it will do that for
me...

don't go into subchildren and update them to pull in there children
just to find out the childCount...  DIDLLite now doesn't include it
if there aren't any...  (This may need to be tested w/ the Intel
software, but works great w/ the D-Link DSM-520)...  It makes
browsing shoutcast genres doable now..

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

+ 5
- 14
ContentDirectory.py View File

@@ -179,6 +179,8 @@ class ContentDirectoryControl(UPnPPublisher, dict):
def soap_Browse(self, *args):
l = {}
debug.appendnamespace(reqname, l)
if self.has_key(args[0]):
l['object'] = self[args[0]]
l['query'] = 'Browse(ObjectID=%s, BrowseFlags=%s, Filter=%s, ' \
'StartingIndex=%s RequestedCount=%s SortCriteria=%s)' % \
tuple(map(repr, args))
@@ -188,7 +190,7 @@ class ContentDirectoryControl(UPnPPublisher, dict):
except defer.Deferred, x:
ret = doRecallgen(x, self.soap_Browse, *args)

l['response'] = `ret`
l['response'] = ret

return ret

@@ -207,24 +209,13 @@ class ContentDirectoryControl(UPnPPublisher, dict):
# check to see if object needs to be updated
self[ObjectID].checkUpdate()

# return error code if we don't exist
# return error code if we don't exist anymore
if ObjectID not in self:
raise errorCode(701)

if BrowseFlag == 'BrowseDirectChildren':
ch = self.getchildren(ObjectID)[StartingIndex: StartingIndex + RequestedCount]
# 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.
# XXX - technically if list changed, we need to get
# some new ones by looping till we have a complete
# list.
ochup = filter(lambda x, s = self: s.has_key(x.id) and
s[x.id].checkUpdate() is not None, ch)
if len(ochup) != len(ch):
log.msg('ch:', `ch`, 'ochup:', `ochup`)
raise RuntimeError, 'something disappeared'
filter(lambda x, d = didl: d.addItem(x) and None, ochup)
filter(lambda x, d = didl: d.addItem(x) and None, ch)
total = len(self.getchildren(ObjectID))
else:
didl.addItem(self[ObjectID])


Loading…
Cancel
Save