@@ -386,7 +386,7 @@ def all(self, sort=None, **kwargs):
386386 sortStr = ''
387387 if sort is not None :
388388 sortStr = '?sort=' + sort
389-
389+
390390 key = '/library/sections/%s/all%s' % (self .key , sortStr )
391391 return self .fetchItems (key , ** kwargs )
392392
@@ -994,6 +994,8 @@ def _loadData(self, data):
994994 self .childCount = utils .cast (int , data .attrib .get ('childCount' ))
995995 self .minYear = utils .cast (int , data .attrib .get ('minYear' ))
996996 self .maxYear = utils .cast (int , data .attrib .get ('maxYear' ))
997+ self .collectionMode = data .attrib .get ('collectionMode' )
998+ self .collectionSort = data .attrib .get ('collectionSort' )
997999
9981000 @property
9991001 def children (self ):
@@ -1006,5 +1008,48 @@ def delete(self):
10061008 part = '/library/metadata/%s' % self .ratingKey
10071009 return self ._server .query (part , method = self ._server ._session .delete )
10081010
1011+ def modeUpdate (self , mode = None ):
1012+ """ Update Collection Mode
1013+
1014+ Parameters:
1015+ mode: default (Library default)
1016+ hide (Hide Collection)
1017+ hideItems (Hide Items in this Collection)
1018+ showItems (Show this Collection and its Items)
1019+ Example:
1020+
1021+ collection = 'plexapi.library.Collections'
1022+ collection.updateMode(mode="hide")
1023+ """
1024+ mode_dict = {'default' : '-2' ,
1025+ 'hide' : '0' ,
1026+ 'hideItems' : '1' ,
1027+ 'showItems' : '2' }
1028+ key = mode_dict .get (mode )
1029+ if key is None :
1030+ raise BadRequest ('Unknown collection mode : %s. Options %s' % (mode , list (mode_dict )))
1031+ part = '/library/metadata/%s/prefs?collectionMode=%s' % (self .ratingKey , key )
1032+ return self ._server .query (part , method = self ._server ._session .put )
1033+
1034+ def sortUpdate (self , sort = None ):
1035+ """ Update Collection Sorting
1036+
1037+ Parameters:
1038+ sort: realease (Order Collection by realease dates)
1039+ alpha (Order Collection Alphabetically)
1040+
1041+ Example:
1042+
1043+ colleciton = 'plexapi.library.Collections'
1044+ collection.updateSort(mode="alpha")
1045+ """
1046+ sort_dict = {'release' : '0' ,
1047+ 'alpha' : '1' }
1048+ key = sort_dict .get (sort )
1049+ if key is None :
1050+ raise BadRequest ('Unknown sort dir: %s. Options: %s' % (sort , list (sort_dict )))
1051+ part = '/library/metadata/%s/prefs?collectionSort=%s' % (self .ratingKey , key )
1052+ return self ._server .query (part , method = self ._server ._session .put )
1053+
10091054 # def edit(self, **kwargs):
10101055 # TODO
0 commit comments