Uh oh!
There was an error while loading. Please reload this page.
Edit Library and Show's Advanced Settings - #507
Conversation
allow for editing a show's advanced settings using kwargs
allows for defaulting all advanced settings
I can move/add these methods to defpreferences(self):
""" Returns a list of :class:`~plexapi.settings.Preferences` objects. """items= []
data=self._server.query(self._details_key)
foritemindata.iter('Preferences'):
foreleminitem:
setting=settings.Preferences(data=elem, server=self._server)
setting._initpath=self.keyitems.append(setting)
returnitemsThis way the settings could be updated from the show object in mass or from the preference object. |
blacktwin
commented
Jun 6, 2020
I should add some tests to this. Switch settings, reload, assert. |
blacktwin
commented
Jul 11, 2020
@Hellowlol this should be ready for review. |
| if self.type == 'int': | ||
| url = key + '%s=%s' % (self.id, self.default) | ||
| else: | ||
| url = key + '%s=%s' % (self.id, self.default.decode()) |
There was a problem hiding this comment.
Is it still needed to decode this? py2 has been dropped.
There was a problem hiding this comment.
.default is a value so it also is a byte that is either an int or str.
| try: | ||
| enumValues = [int(x) for x in preferences.get(settingID)] | ||
| except ValueError: | ||
| enumValues = [x.decode() for x in preferences.get(settingID)] |
There was a problem hiding this comment.
same again, why do we need to decode?
There was a problem hiding this comment.
The .value can be classed as a byte that is either an int or str. Majority of the time they're int-1, 1, 2 something like that.
There was a problem hiding this comment.
_bool_cast=lambdax: Trueifx=='true'orx=='1'elseFalse_bool_str=lambdax: str(x).lower()
_str=lambdax: str(x).encode('utf-8') # py2 dependant?TYPES= {
'bool': {'type': bool, 'cast': _bool_cast, 'tostr': _bool_str},
'double': {'type': float, 'cast': float, 'tostr': _str},
'int': {'type': int, 'cast': int, 'tostr': _str},
'text': {'type': str, 'cast': _str , 'tostr': _str},
}Updating the the tostr: _str references to tostr: str should resolve the issue.
update _str references to use builin str instead update settings.Preferences class for py2 drop
…nt/int based change
jjlawren
commented
Sep 17, 2020
Calling |
coveralls
commented
Sep 28, 2020
py2 support has been dropped. returning str instead of bytes now due to 5045ddc
blacktwin
commented
Sep 30, 2020
This PR should be gtg. |
Allow for editing a show's advanced settings
show.editAdvanced(showOrdering='aired', autoDeletionItemPolicyWatchedLibrary=0)Allow for editing a library's advanced settings
library.editAdvanced(enableBIFGeneration=0, collectionMode=2)