Bump plexapi from 4.15.11 to 4.15.12 (#2311)

* Bump plexapi from 4.15.11 to 4.15.12

Bumps [plexapi](https://github.com/pkkid/python-plexapi) from 4.15.11 to 4.15.12.
- [Release notes](https://github.com/pkkid/python-plexapi/releases)
- [Commits](https://github.com/pkkid/python-plexapi/compare/4.15.11...4.15.12)

---
updated-dependencies:
- dependency-name: plexapi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update plexapi==4.15.12

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

[skip ci]
This commit is contained in:
dependabot[bot] 2024-05-09 22:27:15 -07:00 committed by GitHub
parent 6414a0ba12
commit 3e8a5663a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 12 deletions

View file

@ -170,7 +170,16 @@ class PlexObject:
elem = ElementTree.fromstring(xml)
return self._buildItemOrNone(elem, cls)
def fetchItems(self, ekey, cls=None, container_start=None, container_size=None, maxresults=None, **kwargs):
def fetchItems(
self,
ekey,
cls=None,
container_start=None,
container_size=None,
maxresults=None,
params=None,
**kwargs,
):
""" Load the specified key to find and build all items with the specified tag
and attrs.
@ -186,6 +195,7 @@ class PlexObject:
container_start (None, int): offset to get a subset of the data
container_size (None, int): How many items in data
maxresults (int, optional): Only return the specified number of results.
params (dict, optional): Any additional params to add to the request.
**kwargs (dict): Optionally add XML attribute to filter the items.
See the details below for more info.
@ -268,7 +278,7 @@ class PlexObject:
headers['X-Plex-Container-Start'] = str(container_start)
headers['X-Plex-Container-Size'] = str(container_size)
data = self._server.query(ekey, headers=headers)
data = self._server.query(ekey, headers=headers, params=params)
subresults = self.findItems(data, cls, ekey, **kwargs)
total_size = utils.cast(int, data.attrib.get('totalSize') or data.attrib.get('size')) or len(subresults)
@ -283,6 +293,11 @@ class PlexObject:
results.extend(subresults)
container_start += container_size
if container_start > total_size:
break
wanted_number_of_items = total_size - offset
if maxresults is not None:
wanted_number_of_items = min(maxresults, wanted_number_of_items)
@ -291,11 +306,6 @@ class PlexObject:
if wanted_number_of_items <= len(results):
break
container_start += container_size
if container_start > total_size:
break
return results
def fetchItem(self, ekey, cls=None, **kwargs):
@ -337,7 +347,7 @@ class PlexObject:
kwargs['type'] = cls.TYPE
# rtag to iter on a specific root tag using breadth-first search
if rtag:
data = next(utils.iterXMLBFS(data, rtag), [])
data = next(utils.iterXMLBFS(data, rtag), Element('Empty'))
# loop through all data elements to find matches
items = MediaContainer[cls](self._server, data, initpath=initpath) if data.tag == 'MediaContainer' else []
for elem in data:

View file

@ -4,6 +4,6 @@
# Library version
MAJOR_VERSION = 4
MINOR_VERSION = 15
PATCH_VERSION = 11
PATCH_VERSION = 12
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__ = f"{__short_version__}.{PATCH_VERSION}"

View file

@ -746,7 +746,7 @@ class PlexServer(PlexObject):
""" Returns list of all :class:`~plexapi.media.TranscodeJob` objects running or paused on server. """
return self.fetchItems('/status/sessions/background')
def query(self, key, method=None, headers=None, timeout=None, **kwargs):
def query(self, key, method=None, headers=None, params=None, timeout=None, **kwargs):
""" Main method used to handle HTTPS requests to the Plex server. This method helps
by encoding the response to utf-8 and parsing the returned XML into and
ElementTree object. Returns None if no data exists in the response.
@ -756,7 +756,7 @@ class PlexServer(PlexObject):
timeout = timeout or self._timeout
log.debug('%s %s', method.__name__.upper(), url)
headers = self._headers(**headers or {})
response = method(url, headers=headers, timeout=timeout, **kwargs)
response = method(url, headers=headers, params=params, timeout=timeout, **kwargs)
if response.status_code not in (200, 201, 204):
codename = codes.get(response.status_code)[0]
errtext = response.text.replace('\n', ' ')

View file

@ -26,7 +26,7 @@ musicbrainzngs==0.7.1
packaging==24.0
paho-mqtt==2.0.0
platformdirs==4.2.0
plexapi==4.15.11
plexapi==4.15.12
portend==3.2.0
profilehooks==1.12.0
PyJWT==2.8.0