Skip to content

Commit 2e7ae1f

Browse files
authored
Fix LibrarySection totalViewSize for photo libraries (#715)
1 parent 2a810c6 commit 2e7ae1f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

plexapi/library.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def fetchItems(self, ekey, cls=None, container_start=None, container_size=None,
394394
@property
395395
def totalSize(self):
396396
""" Returns the total number of items in the library for the default library type. """
397-
return self.totalViewSize(libtype=self.TYPE, includeCollections=False)
397+
return self.totalViewSize(includeCollections=False)
398398

399399
def totalViewSize(self, libtype=None, includeCollections=True):
400400
""" Returns the total number of items in the library for a specified libtype.
@@ -414,7 +414,10 @@ def totalViewSize(self, libtype=None, includeCollections=True):
414414
'X-Plex-Container-Size': 0
415415
}
416416
if libtype is not None:
417-
args['type'] = utils.searchType(libtype)
417+
if libtype == 'photo':
418+
args['clusterZoomLevel'] = 1
419+
else:
420+
args['type'] = utils.searchType(libtype)
418421
part = '/library/sections/%s/all%s' % (self.key, utils.joinArgs(args))
419422
data = self._server.query(part)
420423
return utils.cast(int, data.attrib.get("totalSize"))

0 commit comments

Comments
 (0)