pablodz / pipewire_python

Python controller, player and recorder via pipewire's commands
https://pablodz.github.io/pipewire_python/html/
MIT License
22 stars 7 forks source link

Functions not working when prio=-1 #5

Closed BanditSan closed 3 years ago

BanditSan commented 3 years ago

EasyEffects sets Sinks prio=-1

$ pw-cat --playback --list-targets
Available targets ("*" denotes default): 
*   41: description="HyperX 7.1 Audio Analog Stereo" prio=945
    165: description="EasyEffects Sink" prio=-1

all functions not working while easyeffects is enabled with error:

>>> Controller().get_versiom()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/.local/lib/python3.9/site-packages/pipewire_python/controller.py", line 126, in __init__
    self.load_list_targets(mode="playback", verbose=verbose)
  File "~/.local/lib/python3.9/site-packages/pipewire_python/controller.py", line 423, in load_list_targets
    self._pipewire_list_targets["list_playblack"] = _generate_dict_list_targets(
  File "~/.local/lib/python3.9/site-packages/pipewire_python/_utils.py", line 189, in _generate_dict_list_targets
    "prior": results_regex_prio[idx],
IndexError: list index out of range

without easyeefects all works fine

>>> Controller().get_list_targets()
{'list_playblack': {'41': {'description': 'HyperX 7.1 Audio Analog Stereo', 'prior': '945'}, '_list_nodes': ['41'], '_node_default': ['41'], '_alsa_node': []}, 'list_record': {'42': {'description': 'HyperX 7.1 Audio Analog Stereo', 'prior': '1945'}, '_list_nodes': ['42'], '_node_default': ['42'], '_alsa_node': []}}
pablodz commented 3 years ago

I'll check the commands due pipewire_python is handling commands with the shell output

BanditSan commented 3 years ago

Looked bit at the code and i think it's not shell output.

in _utils.py at line 175

regex_prio = r"prio=(\d.*)"

\d matches unicode digit if im not wrong and - is not a digit

pablodz commented 3 years ago

I'm releasing a new version of the package

pablodz commented 3 years ago

Please, update to v0.0.93

BanditSan commented 3 years ago

This version now broken with or without easyeffects

BanditSan commented 3 years ago

@pablodz Works doing this way:

regex_prio = r"prio=(-?\d.*)"
pablodz commented 3 years ago

@pablodz Works doing this way:

regex_prio = r"prio=(-?\d.*)"

okey, there's now a v0.0.94 on pypi