Add script to rename remap-sink sink-inputs

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-04-27 11:24:32 +02:00
parent 01bfb75abd
commit a319889330
Signed by: luzifer
GPG Key ID: 0066F03ED215AD7D

21
bin/pulse-rename-remap Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python
import contextlib
import pulsectl
with pulsectl.Pulse('Remap-Sink Name-Fix') as pulse:
for sink_input in pulse.sink_input_list():
if not sink_input.name.startswith('Remapped Stream'):
continue
for sink in pulse.sink_list():
if sink.owner_module != sink_input.owner_module:
continue
with contextlib.closing(pulsectl.connect_to_cli(as_file=False)) as s:
cmd = 'update-sink-input-proplist {} media.name="{}"\n'.format(
sink_input.index,
'Remapped Stream: {}'.format(sink.description),
)
s.send(cmd.encode('utf-8'))