Add script to rename remap-sink sink-inputs
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
01bfb75abd
commit
a319889330
1 changed files with 21 additions and 0 deletions
21
bin/pulse-rename-remap
Executable file
21
bin/pulse-rename-remap
Executable 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'))
|
Loading…
Reference in a new issue