@@ -541,12 +541,11 @@ def delete(self):
541
541
log .error (msg )
542
542
raise
543
543
544
- def reload (self ):
544
+ def _reload (self , ** kwargs ):
545
545
""" Reload the data for the library section. """
546
- self ._server .library ._loadSections ()
547
- newLibrary = self ._server .library .sectionByID (self .key )
548
- self .__dict__ .update (newLibrary .__dict__ )
549
- self ._invalidateCachedProperties ()
546
+ key = self ._initpath
547
+ data = self ._server .query (key )
548
+ self ._findAndLoadElem (data , key = str (self .key ))
550
549
return self
551
550
552
551
def edit (self , agent = None , ** kwargs ):
@@ -2210,10 +2209,10 @@ class Hub(PlexObject):
2210
2209
context (str): The context of the hub.
2211
2210
hubKey (str): API URL for these specific hub items.
2212
2211
hubIdentifier (str): The identifier of the hub.
2213
- items (list): List of items in the hub.
2212
+ items (list): List of items in the hub (automatically loads all items if more is True) .
2214
2213
key (str): API URL for the hub.
2215
- more (bool): True if there are more items to load (call reload() to fetch all items).
2216
2214
random (bool): True if the items in the hub are randomized.
2215
+ more (bool): True if there are more items to load (call items to fetch all items).
2217
2216
size (int): The number of items in the hub.
2218
2217
style (str): The style of the hub.
2219
2218
title (str): The title of the hub.
@@ -2248,20 +2247,20 @@ def items(self):
2248
2247
def __len__ (self ):
2249
2248
return self .size
2250
2249
2251
- def reload (self ):
2252
- """ Delete cached data to allow reloading of hub items. """
2253
- self ._invalidateCachedProperties ()
2254
- if self ._data is not None :
2255
- self .more = utils .cast (bool , self ._data .attrib .get ('more' ))
2256
- self .size = utils .cast (int , self ._data .attrib .get ('size' ))
2257
-
2258
2250
def section (self ):
2259
2251
""" Returns the :class:`~plexapi.library.LibrarySection` this hub belongs to.
2260
2252
"""
2261
2253
if self ._section is None :
2262
2254
self ._section = self ._server .library .sectionByID (self .librarySectionID )
2263
2255
return self ._section
2264
2256
2257
+ def _reload (self , ** kwargs ):
2258
+ """ Reload the data for the hub. """
2259
+ key = self ._initpath
2260
+ data = self ._server .query (key )
2261
+ self ._findAndLoadElem (data , hubIdentifier = self .hubIdentifier )
2262
+ return self
2263
+
2265
2264
2266
2265
class LibraryMediaTag (PlexObject ):
2267
2266
""" Base class of library media tags.
@@ -3032,11 +3031,11 @@ def _loadData(self, data):
3032
3031
parent = self ._parent ()
3033
3032
self .librarySectionID = parent .key if isinstance (parent , LibrarySection ) else parent .librarySectionID
3034
3033
3035
- def reload (self ):
3034
+ def _reload (self , ** kwargs ):
3036
3035
""" Reload the data for this managed hub. """
3037
3036
key = f'/hubs/sections/{ self .librarySectionID } /manage'
3038
- hub = self .fetchItem (key , self . __class__ , identifier = self . identifier )
3039
- self .__dict__ . update ( hub . __dict__ )
3037
+ data = self ._server . query (key )
3038
+ self ._findAndLoadElem ( data , identifier = self . identifier )
3040
3039
return self
3041
3040
3042
3041
def move (self , after = None ):
0 commit comments