Adding collection sorting

collectionSort to data and sortUpdate function.
This commit is contained in:
blacktwin 2019-07-25 14:46:41 -04:00 committed by GitHub
parent 9149d999e0
commit 02026cc65b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -995,6 +995,7 @@ class Collections(PlexObject):
self.minYear = utils.cast(int, data.attrib.get('minYear'))
self.maxYear = utils.cast(int, data.attrib.get('maxYear'))
self.collectionMode = data.attrib.get('collectionMode')
self.collectionSort = data.attrib.get('collectionSort')
@property
def children(self):
@ -1015,5 +1016,11 @@ class Collections(PlexObject):
part = '/library/metadata/%s/prefs?collectionMode=%s' % (self.ratingKey, mode_dict[mode])
return self._server.query(part, method=self._server._session.put)
def sortUpdate(self, sort=['release', 'alpha']):
sort_dict = {'release': '0',
'alpha': '1'}
part = '/library/metadata/%s/prefs?collectionSort=%s' % (self.ratingKey, sort_dict[sort])
return self._server.query(part, method=self._server._session.put)
# def edit(self, **kwargs):
# TODO