Skip to content

Commit 668fdbb

Browse files
glenscJonnyWong16
andauthored
Allow overriding includeUserState for _toOnlineMetadata (#1071)
* Allow overriding includeUserState for _toOnlineMetadata * Pass kwargs from watchlist to _toOnlineMetadata Co-authored-by: JonnyWong16 <[email protected]>
1 parent c3d2a56 commit 668fdbb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

plexapi/myplex.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ def watchlist(self, filter=None, sort=None, libtype=None, maxresults=9999999, **
869869
if maxresults > totalSize:
870870
maxresults = totalSize
871871

872-
return self._toOnlineMetadata(results)
872+
return self._toOnlineMetadata(results, **kwargs)
873873

874874
def onWatchlist(self, item):
875875
""" Returns True if the item is on the user's watchlist.
@@ -1013,21 +1013,24 @@ def link(self, pin):
10131013
data = {'code': pin}
10141014
self.query(self.LINK, self._session.put, headers=headers, data=data)
10151015

1016-
def _toOnlineMetadata(self, objs):
1016+
def _toOnlineMetadata(self, objs, **kwargs):
10171017
""" Convert a list of media objects to online metadata objects. """
10181018
# TODO: Add proper support for metadata.provider.plex.tv
10191019
# Temporary workaround to allow reloading and browsing of online media objects
10201020
server = PlexServer(self.METADATA, self._token, session=self._session)
10211021

1022+
includeUserState = int(bool(kwargs.pop('includeUserState', True)))
1023+
10221024
if not isinstance(objs, list):
10231025
objs = [objs]
1026+
10241027
for obj in objs:
10251028
obj._server = server
10261029

10271030
# Parse details key to modify query string
10281031
url = urlsplit(obj._details_key)
10291032
query = dict(parse_qsl(url.query))
1030-
query['includeUserState'] = 1
1033+
query['includeUserState'] = includeUserState
10311034
query.pop('includeFields', None)
10321035
obj._details_key = urlunsplit((url.scheme, url.netloc, url.path, urlencode(query), url.fragment))
10331036

0 commit comments

Comments
 (0)