Skip to content

Commit a06a43f

Browse files
committed
refactor: Better align the items and reload functions with the internal caching mechanism
1 parent 0320360 commit a06a43f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: plexapi/library.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -2235,17 +2235,20 @@ def _loadData(self, data):
22352235

22362236
@cached_data_property
22372237
def items(self):
2238+
if self.more and self.key: # If there are more items to load, fetch them
2239+
items = self.fetchItems(self.key)
2240+
self.more = False
2241+
self.size = len(items)
2242+
return items
2243+
# Otherwise, all the data is in the initial _data XML response
22382244
return self.findItems(self._data)
22392245

22402246
def __len__(self):
22412247
return self.size
22422248

22432249
def reload(self):
22442250
""" Reloads the hub to fetch all items in the hub. """
2245-
if self.more and self.key:
2246-
self.items = self.fetchItems(self.key)
2247-
self.more = False
2248-
self.size = len(self.items)
2251+
self._invalidateCachedProperties()
22492252

22502253
def section(self):
22512254
""" Returns the :class:`~plexapi.library.LibrarySection` this hub belongs to.

0 commit comments

Comments
 (0)