Fix parsing settings enum (#1057)

* Assume key and value are equal when missing `key:value` pair
This commit is contained in:
JonnyWong16 2022-12-21 11:34:50 -08:00 committed by GitHub
parent 9dbb2e5169
commit e5d3ebe273
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -139,7 +139,14 @@ class Setting(PlexObject):
if not enumstr:
return None
if ':' in enumstr:
return {self._cast(k): v for k, v in [kv.split(':') for kv in enumstr.split('|')]}
d = {}
for kv in enumstr.split('|'):
try:
k, v = kv.split(':')
d[self._cast(k)] = v
except ValueError:
d[self._cast(kv)] = kv
return d
return enumstr.split('|')
def set(self, value):