diff --git a/ContentDirectory.py b/ContentDirectory.py index 2da39ab..bef2b5b 100644 --- a/ContentDirectory.py +++ b/ContentDirectory.py @@ -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])