fixes bug if no flags are passed

patch bump
This commit is contained in:
onyx-and-iris 2025-04-22 00:26:32 +01:00
parent 023fdf708b
commit df18d9c192
2 changed files with 10 additions and 16 deletions

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online> # SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
__version__ = "0.6.7" __version__ = "0.6.8"

View File

@ -25,21 +25,15 @@ def list(
"""List all inputs.""" """List all inputs."""
resp = ctx.obj['obsws'].get_input_list() resp = ctx.obj['obsws'].get_input_list()
# For each kind flag, if it is set to True, add it to the kinds list. kinds = []
# If no flags are set, default to all kinds. if input:
# Define a mapping of kind names to their corresponding flags kinds.append('input')
kind_flags = { if output:
'input': input, kinds.append('output')
'output': output, if colour:
'color': colour, kinds.append('colour')
} if not any([input, output, colour]):
kinds = ['input', 'output', 'colour']
# Collect all kinds where the corresponding flag is set to True
kinds = [kind for kind, flag in kind_flags.items() if flag]
# If no flags are set, default to all kinds
if not kinds:
kinds = list(kind_flags.keys())
inputs = filter( inputs = filter(
lambda input_: any(kind in input_.get('inputKind') for kind in kinds), lambda input_: any(kind in input_.get('inputKind') for kind in kinds),