chris-ritsen / network-audio-controller

Cross-platform CLI control of Dante network audio devices without Dante Controller
The Unlicense
203 stars 21 forks source link

Adding subscriptions by channel number not working #10

Open jamesremuscat opened 2 years ago

jamesremuscat commented 2 years ago

Attempting to add a subscription by channel number does not work (results in RuntimeError: coroutine raised StopIteration).

I think this is because it's attempting to match channel.number (which is an int) against self.option('rx-channel-number') (which is a str). I added a line of debugging to commands/subscription/_add.py as follows:

# ...
elif self.option("rx-channel-number"):

            for ch in rx_device.rx_channels.values():
                print('Considering', ch.number, type(ch.number), type(self.option('rx-channel-number')), ch.number == self.option('rx-channel-number'))
# ...

resulting in:

$ netaudio subscription add --tx-device-name StreamPC --tx-channel-name Right --rx-device-name VisualsPC --rx-channel-number 1
Considering 1 <class 'int'> <class 'str'> False
Considering 2 <class 'int'> <class 'str'> False
Considering 3 <class 'int'> <class 'str'> False
Considering 4 <class 'int'> <class 'str'> False
Considering 5 <class 'int'> <class 'str'> False
Considering 6 <class 'int'> <class 'str'> False
Considering 7 <class 'int'> <class 'str'> False
Considering 8 <class 'int'> <class 'str'> False
Considering 9 <class 'int'> <class 'str'> False
Considering 10 <class 'int'> <class 'str'> False
Considering 11 <class 'int'> <class 'str'> False
Considering 12 <class 'int'> <class 'str'> False
Considering 13 <class 'int'> <class 'str'> False
Considering 14 <class 'int'> <class 'str'> False
Considering 15 <class 'int'> <class 'str'> False
Considering 16 <class 'int'> <class 'str'> False

In case it makes a difference, this is on both Python 3.8 and 3.9, using v0.0.10 of netaudio.