Add collectionMode data and modeUpdate

Added collectionMode to collection data. 
modUpdate acts like webUI, `collection.modeUpdate(mode="default")`
This commit is contained in:
blacktwin 2019-07-25 14:30:48 -04:00 committed by GitHub
parent bd033a9f7e
commit 9149d999e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -994,6 +994,7 @@ class Collections(PlexObject):
self.childCount = utils.cast(int, data.attrib.get('childCount'))
self.minYear = utils.cast(int, data.attrib.get('minYear'))
self.maxYear = utils.cast(int, data.attrib.get('maxYear'))
self.collectionMode = data.attrib.get('collectionMode')
@property
def children(self):
@ -1005,6 +1006,14 @@ class Collections(PlexObject):
def delete(self):
part = '/library/metadata/%s' % self.ratingKey
return self._server.query(part, method=self._server._session.delete)
def modeUpdate(self, mode=['default', 'hide', 'hideItems', 'showItems']):
mode_dict = {'default': '-2',
'hide': '0',
'hideItems': '1',
'showItems': '2'}
part = '/library/metadata/%s/prefs?collectionMode=%s' % (self.ratingKey, mode_dict[mode])
return self._server.query(part, method=self._server._session.put)
# def edit(self, **kwargs):
# TODO