From 63f875cf66f5cc487ecf9e13558129e8445bc992 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Mon, 29 Mar 2021 00:27:07 -0700 Subject: [PATCH] Fix LibrarySection totalViewSize for photo libraries --- plexapi/library.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plexapi/library.py b/plexapi/library.py index 0bfeb1feb..437bda037 100644 --- a/plexapi/library.py +++ b/plexapi/library.py @@ -394,7 +394,7 @@ def fetchItems(self, ekey, cls=None, container_start=None, container_size=None, @property def totalSize(self): """ Returns the total number of items in the library for the default library type. """ - return self.totalViewSize(libtype=self.TYPE, includeCollections=False) + return self.totalViewSize(includeCollections=False) def totalViewSize(self, libtype=None, includeCollections=True): """ Returns the total number of items in the library for a specified libtype. @@ -414,7 +414,10 @@ def totalViewSize(self, libtype=None, includeCollections=True): 'X-Plex-Container-Size': 0 } if libtype is not None: - args['type'] = utils.searchType(libtype) + if libtype == 'photo': + args['clusterZoomLevel'] = 1 + else: + args['type'] = utils.searchType(libtype) part = '/library/sections/%s/all%s' % (self.key, utils.joinArgs(args)) data = self._server.query(part) return utils.cast(int, data.attrib.get("totalSize"))