Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v7.1.1+beta.4 #955

Merged
merged 12 commits into from
Nov 2, 2024
Prev Previous commit
Next Next commit
Improve parsing of tri-state query parameters and settings
  • Loading branch information
MoojMidge committed Nov 2, 2024
commit 2a52a2515b114628ed4bfb14a31ece1c041c62a3
4 changes: 4 additions & 0 deletions resources/lib/youtube_plugin/kodion/constants/__init__.py
Original file line number Diff line number Diff line change
@@ -36,7 +36,11 @@
'0': False,
'1': True,
'false': False,
'False': False,
'true': True,
'True': True,
'None': None,
'null': None,
}

# Flags
16 changes: 7 additions & 9 deletions resources/lib/youtube_plugin/kodion/context/abstract_context.py
Original file line number Diff line number Diff line change
@@ -322,15 +322,13 @@ def parse_params(self, params, update=True):
for param, value in params.items():
try:
if param in self._BOOL_PARAMS:
parsed_value = VALUE_FROM_STR.get(str(value).lower(), False)
parsed_value = VALUE_FROM_STR.get(str(value), False)
elif param in self._INT_PARAMS:
parsed_value = None
if param in self._INT_BOOL_PARAMS:
parsed_value = VALUE_FROM_STR.get(str(value).lower())
if parsed_value is None:
parsed_value = int(value)
else:
parsed_value = int(parsed_value)
parsed_value = int(
(VALUE_FROM_STR.get(str(value), value) or 0)
if param in self._INT_BOOL_PARAMS else
value
)
elif param in self._FLOAT_PARAMS:
parsed_value = float(value)
elif param in self._LIST_PARAMS:
@@ -343,7 +341,7 @@ def parse_params(self, params, update=True):
parsed_value = to_str(value)
if param in self._STRING_BOOL_PARAMS:
parsed_value = VALUE_FROM_STR.get(
parsed_value.lower(), parsed_value
parsed_value, parsed_value
)
# process and translate deprecated parameters
elif param == 'action':
Original file line number Diff line number Diff line change
@@ -144,7 +144,7 @@ def get_bool(self, setting, default=None, echo=None):
except (TypeError, ValueError) as exc:
error = exc
try:
value = self.get_string(setting, echo=False).lower()
value = self.get_string(setting, echo=False)
value = VALUE_FROM_STR.get(value, default)
except TypeError as exc:
error = exc