Skip to content

Commit 5d9df1a

Browse files
another approach
1 parent 62afc1b commit 5d9df1a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

plexapi/base.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,12 @@ def fetchItems(self, ekey, cls=None, **kwargs):
145145
on how this is used.
146146
"""
147147
data = self._server.query(ekey)
148-
return self.findItems(data, cls, ekey, **kwargs)
148+
items = self.findItems(data, cls, ekey, **kwargs)
149+
librarySectionID = data.attrib.get('librarySectionID')
150+
if librarySectionID:
151+
for item in items:
152+
item.librarySectionID = librarySectionID
153+
return items
149154

150155
def findItems(self, data, cls=None, initpath=None, **kwargs):
151156
""" Load the specified data to find and build all items with the specified tag
@@ -159,13 +164,10 @@ def findItems(self, data, cls=None, initpath=None, **kwargs):
159164
kwargs['type'] = cls.TYPE
160165
# loop through all data elements to find matches
161166
items = []
162-
librarySectionID = data.attrib.get('librarySectionID')
163167
for elem in data:
164168
if self._checkAttrs(elem, **kwargs):
165169
item = self._buildItemOrNone(elem, cls, initpath)
166170
if item is not None:
167-
if librarySectionID:
168-
item.librarySectionID = librarySectionID
169171
items.append(item)
170172
return items
171173

0 commit comments

Comments
 (0)